DUEL Methodology:
Transparent Relative Stock Comparison

Why relative comparison beats absolute scoring — and how DUEL implements it with full transparency.

1. The Problem with Absolute Scoring

Most stock screeners show absolute numbers — revenue growth of 15%, ROIC of 20%, etc. But absolute numbers don't tell you who is better. A company with 15% growth might be underperforming its competitor with 30% growth, yet it still looks "good" in isolation.

Traditional rating systems (e.g., "10/10" or "A+") are even worse: they are subjective, often based on analyst opinions, and lack transparency. They don't answer the only question that matters: "Which stock is the better investment right now?"

2. The DUEL Solution: Relative Comparison

DUEL replaces absolute scoring with head‑to‑head comparison. Every factor is normalized between exactly two stocks. The winner isn't the one with the highest absolute values — it's the one that outperforms the opponent across a weighted set of fundamental metrics.

📐 Core Formula: Score = Σ ( Wᵢ × Nᵢ ) × 100
Where Wᵢ = factor weight (sum = 1.0) · Nᵢ = normalized rank vs opponent (0=lose, 1=win, 0.5=tie). Missing data → neutral 0.5.

This approach eliminates bias from "good" vs "bad" benchmarks. It reveals who is objectively stronger at a given point in time, based purely on reported financial data.

3. Key Technical Decisions — Code Examples

Below are five critical implementation decisions that make DUEL unique, robust, and scalable. These snippets demonstrate the depth of the algorithm.

3.1. Smart Period Alignment (Annual vs Quarterly)

Companies report data in different periods. DUEL automatically detects when a quarterly/annual mismatch exists and corrects it.

# Detect period mismatch and adjust 3-year revenue accordingly if rev_period == 'Q' and (rev_3y_period == 'Y' or rev_3y / revenue > 3.5): rev_3y_adjusted = rev_3y / 4.0 revenue_growth = (pow(revenue / rev_3y_adjusted, 1/3) - 1) * 100 adjusted = True logger.info(f"Revenue Growth adjusted: rev_3y_original={rev_3y}, rev_3y_adjusted={rev_3y_adjusted}")

Why this matters: Without this adjustment, comparing a quarterly figure against an annual figure would produce meaningless results. DUEL automatically detects and corrects this, then logs the change for full transparency.

3.2. Async Loading with Smart Caching

SEC EDGAR can be slow. DUEL uses async requests with a 6‑hour database cache to ensure fast response times.

# Async + caching architecture async def get_company_data_async(loop, ticker, no_cache=False): # 1. Check cache cached = await loop.run_in_executor(None, db_query_sync, "SELECT data_json, updated_at FROM ticker_cache WHERE ticker=%s", (ticker,), True) if cached and age_h < config.CACHE_HOURS: return json.loads(cached['data_json']) # 2. Load from SEC async with aiohttp.ClientSession() as session: data = await async_build_company_data(session, ticker) # 3. Save cache await loop.run_in_executor(None, db_query_sync, "INSERT INTO ticker_cache (ticker, data_json) VALUES (%s, %s) ON DUPLICATE KEY UPDATE data_json=VALUES(data_json), updated_at=NOW()", (ticker, json.dumps(data, ensure_ascii=False))) return data

Why this matters: Most tools either hit SEC every time (slow) or use a static cache (stale). DUEL combines async requests with a smart caching layer that updates automatically.

3.3. Multi‑Language SEO Text Generation

DUEL generates unique SEO text for every duel in 10 languages, with automatic data substitution.

# One template → 10 languages def generate_summary(a_data, b_data, result, lang='en'): t = SUMMARY_TRANSLATIONS[lang] sentences = [] sentences.append(t['intro'].format(a=ticker_a, b=ticker_b)) sentences.append(t['revenue_a_better'].format( a=ticker_a, val_a=fmt_pct(ra), b=ticker_b, val_b=fmt_pct(rb))) sentences.append(t['conclusion'].format( winner=winner, win_score=win_score, lose_score=lose_score)) sentences.append(t['disclaimer']) return "\n".join(sentences)

Why this matters: This approach generates 100% unique content for every duel, in 10 languages, without manual intervention. This is why DUEL has SEO potential in Turkey, Korea, and Indonesia.

3.4. Universal Normalization with Inverted Factors

Not all factors work the same way — Sloan Ratio is "lower is better". DUEL handles this elegantly.

# Single function handles all 8 factors with inversion support def normalize_pair(a_val, b_val, inverted=False): if a_val is None and b_val is None: return 0.5, 0.5 if a_val is None: return 0.35, 0.65 # missing data penalty if b_val is None: return 0.65, 0.35 lo, hi = min(a_val, b_val), max(a_val, b_val) spread = hi - lo if spread == 0: return 0.5, 0.5 an = (a_val - lo) / spread bn = (b_val - lo) / spread if inverted: return 1 - an, 1 - bn return an, bn

Why this matters: This elegant design handles all 8 factors with one function, automatically punishing missing data and supporting both "higher is better" and "lower is better" metrics.

3.5. Dynamic WACC Based on ROIC Quality

DUEL calculates WACC dynamically based on the company's ROIC tier, reflecting real business risk.

# Risk-adjusted WACC based on business quality if roic is None: beta = 1.0 elif roic >= 25: beta = 0.85 # super-profitable → lower risk elif roic >= 15: beta = 1.0 # good profitability → average risk elif roic >= 5: beta = 1.15 # average → elevated risk else: beta = 1.35 # low/negative → high risk cost_of_equity = 0.045 + beta * 0.055 wacc = weight_equity * cost_of_equity + weight_debt * 0.055 * (1 - 0.21) wacc = max(0.07, min(0.18, wacc))

Why this matters: Instead of using a fixed WACC (like most tools), DUEL adjusts the discount rate based on the company's actual performance. High‑quality businesses get a lower WACC (higher valuation), while risky businesses get a higher WACC (lower valuation).

4. Data Integrity — SEC EDGAR Only

100% data sourced from SEC EDGAR — no analyst estimates, no third-party data.

All financial data used by DUEL is extracted directly from official SEC EDGAR filings (10‑K and 10‑Q). No analyst estimates, no proprietary data feeds — only audited, publicly available numbers.

Each metric includes a timestamp and period marker (Y = Annual, Q = Quarterly), so you always know exactly what you're looking at.

5. Expert Validation — Independent AI Assessments

The DUEL source code and methodology were independently reviewed by two leading AI systems. Below are their expert conclusions:

🤖 Grok (xAI) — Elon Musk

"8.4/10 — very strong, professional product for the niche. This is not a typical 'pet project'. It's a mature MVP with good UX, technical depth, and a clear monetisation model."

"The DCF model with Sloan Ratio adjustment and ROIC/FCF margin quality multipliers is a sophisticated approach rarely seen in retail tools. The technical quality is very high."

Source: Grok (xAI) — independent technical review based on full source code analysis, July 2026

🧠 Gemini (Google DeepMind)

"Architecture and tech stack: 9/10. The use of Flask + async aiohttp for SEC EDGAR requests is an excellent solution for working with external APIs without blocking threads."

"Financial mathematics and SEC parsing are implemented at a high level: intelligent annual/quarterly period alignment, Sloan Ratio for earnings quality, and a full DCF model for PRO users."

Source: Gemini (Google DeepMind) — independent technical architecture review, July 2026

6. Intellectual Property — What's Protected

The DUEL algorithm is a proprietary system. We openly share its conceptual framework and key code examples above. The core implementation details — including full normalisation logic, weight optimisation algorithms, DCF adjustment coefficients, and the data extraction pipeline — are proprietary and remain confidential.

This approach ensures transparency at the principle level while protecting the intellectual property that makes DUEL unique.

In September 2026, we open-sourced the free base 8-factor scoring algorithm on GitHub, including a fully worked example (NVDA vs AMD) — so you can verify exactly how the free comparison is calculated. The PRO-only weight optimisation, DCF valuation model, and Resilience (STR) report remain proprietary and are not published. View the open-source repository on GitHub →

7. Important Disclaimer

DUEL is not an investment advisor. All content is for informational and educational purposes only. Past data does not guarantee future results. Always conduct your own research before making investment decisions.

Try the algorithm yourself →

⚔ Go to DUEL
P.S. The idea of relative stock comparison was conceived by Alex Costa (b. 1977), a qualified investor since 2021 with degrees in Textile Engineering and Geodesy. The technical implementation — Flask backend, SEC EDGAR integration, PDF generation, and multi‑language architecture — was developed with assistance from Claude (Anthropic). The source code was reviewed by Grok (xAI) and Gemini (Google DeepMind) as part of an independent audit.