Skip to content

Unify alternative-data chain templates and fix non-chain bugs#2409

Merged
AlexCatarino merged 2 commits into
QuantConnect:masterfrom
AlexCatarino:align-altdata-chain-templates
May 13, 2026
Merged

Unify alternative-data chain templates and fix non-chain bugs#2409
AlexCatarino merged 2 commits into
QuantConnect:masterfrom
AlexCatarino:align-altdata-chain-templates

Conversation

@AlexCatarino
Copy link
Copy Markdown
Member

Summary

  • Unify the 14 alternative-data-chain-universe-* project templates around one shape — only the alt-data filter expression differs between them. The first universe caches every US Equity fundamental, the second intersects the alt-data filter with that cache, ranks by dollar volume, and keeps the 100 most liquid. A scheduled 9:00 ET rebalance applies a min(1/N, 0.1) weight cap so sparse-day universes don't hit insufficient-buying-power rejections.
  • Fix several non-chain alt-data templates: drop a bad EODHD import in eodhdupcomingipos Py, guard Min().Value on an all-null price band in eodhdupcomingipos C#, add seed_initial_prices = True so newly-joined equities have a price at the 9:00 rebalance, and drop the unpopulated USDMarketCap filter in smartinsiderintentionuniverse.
  • Update the Chain Fundamental and Alternative Data and Chain ETF and Alternative Data doc examples to the new pattern so they actually trade.
  • Align custom-indicator Py to use DataNormalizationMode.RAW to match the C# template.

Test plan

  • python project-templates/python/run_syntax_check.py — 100% across all 72 Python templates.
  • Cloud backtests run on every modified Python and C# template for the Sep 1 – Dec 31 2024 window. Each pair now places orders, has zero invalid orders, and zero margin calls. Py and C# stats match per template.
  • Doc 05 Chain Fundamental and Alternative Data — Py and C# both: 1458 orders, +14.353% net profit, Sharpe 1.648.
  • Doc 08 Chain ETF and Alternative Data — Py and C# both: 889 orders, +12.147% net profit, Sharpe 1.778.

- alternative-data-universe-eodhdupcomingipos: drop invalid
  `from QuantConnect.DataSource.EODHD import DealType` Py import (EODHD is
  a class, not a module); guard C# `Min().Value` against an all-null price
  band so the algorithm no longer throws "Nullable object must have a value".
- alternative-data-universe-quivercnbcsuniverse,
  alternative-data-universe-quiverquantcongressuniverse,
  alternative-data-universe-smartinsiderintentionuniverse,
  alternative-data-universe-smartinsidertransactionuniverse:
  set `seed_initial_prices = True` so newly-joined equities have a price
  at the 9:00 ET rebalance, guard rebalance with a `price > 0` filter, and
  cap individual weights at `min(1/N, 0.1)` so sparse-day universes don't
  trigger insufficient-buying-power rejections.
- alternative-data-universe-smartinsiderintentionuniverse: drop the
  `USDMarketCap > 100_000_000` filter (the field isn't populated for
  intention records in the dataset, so the filter rejected every row).
- custom-indicator Py: set `data_normalization_mode = RAW` to match the C#
  template so both implementations consume the same SPY series.
…attern

All 14 alt-data chain templates now share one shape, with only the
alt-data filter expression differing between them:

- First universe stores every US Equity fundamental and emits
  Universe.Unchanged.
- Second universe filters alt-data into a `alt` set, plots its size as
  Universe/Raw, then intersects with the cached fundamentals and keeps
  the 100 most liquid by dollar volume.
- Scheduled rebalance at 9:00 ET with a `min(1/N, 0.1)` weight cap so
  sparse-day universes don't trigger insufficient-buying-power
  rejections.
- C# uses method-syntax LINQ throughout.

Other changes folded in:

- alternative-data-chain-universe-eodhdupcomingipos: maintain an
  `_ipo_dates` map and trade an IPO seven days after the listing so
  Morningstar fundamentals have caught up. Previously the chain produced
  zero orders because IPO names aren't yet in the fundamental universe.
- alternative-data-chain-universe-smartinsiderintentionuniverse: drop
  the unused `USDMarketCap > 100_000_000` filter (the field isn't
  populated for intention records).
- alternative-data-chain-universe-quiverquantcongressuniverse: fix C#
  `OfType<QuiverCongressDataPoint>` to `OfType<QuiverQuantCongressUniverse>`
  so the same rows that Python iterates are visible to C#.

Doc examples in
`03 Writing Algorithms/12 Universes/03 Equity/04 Chained Universes/`
updated to match: the fundamental + alt-data example now actually
trades (1458 orders, +14.35%, Sharpe 1.65), and the ETF + alt-data
example ranks by `Weight` and drops alt names that aren't in SPY
(889 orders, +12.15%, Sharpe 1.78).
@AlexCatarino AlexCatarino merged commit 3b65e14 into QuantConnect:master May 13, 2026
1 check passed
@AlexCatarino AlexCatarino deleted the align-altdata-chain-templates branch May 13, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant