Logo van Backtest Look Ahead In Universe Selection

Backtest Look Ahead In Universe Selection

Community
HimanshuJ16
backtest-look-ahead-in-universe-selection

Gebruik dit wanneer de backtest de effecten selecteert op basis van een regel, zoals de top 50 op marktkapitalisatie of huidig indexlidmaatschap. Controleert tijdstempels van lidmaatschap, zodat je in 2015 niet handelt met de indexsamenstelling van 2026. Lekkage op feature-niveau valt onder lookahead-bias-elimination.

Add to TypingMind

Overzicht

UitgeverHimanshuJ16
RepositoryAlgo-Trading-Skills
Skillnaambacktest-look-ahead-in-universe-selection
Sterren
50
Forks
7
Meegeleverde bestanden
5
LicentieApache-2.0
Links
  • Instructies in Markdown

    Het model laadt het bestand SKILL.md alleen als dat nodig is. Dat kost dus alleen tokens als een verzoek daadwerkelijk bij de skill past.

  • Werkt met elk LLM

    AI-skills bestaan uit instructies in gewone Markdown, niet uit aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Meegeleverde bestanden: 5

    Scripts, sjablonen en referentiemateriaal die het model tijdens het werken kan lezen. De bestanden kunnen alleen worden gelezen en worden nooit uitgevoerd.

  • Open source

    Gepubliceerd door HimanshuJ16 op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Backtest Look Ahead In Universe Selection in TypingMind om deze met elk LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map. De app leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/backtest-look-ahead-in-universe-selection
  4. Schakel de skill in voor elke chat waarin je de skill wilt kunnen gebruiken.
Plug-ins → Skills → Skill toevoegen → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/HimanshuJ16/Algo-Trading-Skills.git /tmp/Algo-Trading-Skills
mkdir -p .claude/skills
cp -r /tmp/Algo-Trading-Skills/skills/backtest-look-ahead-in-universe-selection .claude/skills/backtest-look-ahead-in-universe-selection
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Backtest Look Ahead In Universe Selection in voor een chat naar keuze in TypingMind en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek bij de skill past, laadt het model zelf de volledige instructies. Je hoeft de skill nooit handmatig aan te roepen. Pas als het model de skill daadwerkelijk gebruikt, kost dat tokens.

Het model laadt Backtest Look Ahead In Universe Selection automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Backtest Look Ahead In Universe Selection niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

When to Use

Invoke this skill when building or validating strategy universe selection rules. Selecting assets for a historical backtest using present-day attributes (e.g., "top 50 stocks by market cap today" or "current S&P 500 constituents" applied to 2015) introduces severe lookahead and survivorship bias. This skill audits universe membership point-in-time timestamps to guarantee zero future data leakage.

Universe membership moves on two independent time axes, and confusing them is the dominant failure mode:

AxisFieldMeaning
Knowledgedata_publication_dateWhen the membership decision and its ranking inputs became public. Read at end of day when date-granular.
Effectiveadded_date, removed_dateWhen membership actually started and ended. Read at start of day.

The two are days to weeks apart. S&P DJI announced Tesla's S&P 500 addition on 2020-11-16, effective prior to the open on 2020-12-21. A backtest rebalancing on 2020-12-01 knew about the addition but must not yet hold it.

When NOT to Use

  • Not a substitute for point-in-time source data. A clean audit means the timestamps you supplied are internally consistent. If every data_publication_date was back-filled from a current-membership table, the audit passes and the backtest is still leaking. Fix provenance first — see backtest-database-schema-for-point-in-time-queries.
  • Not a ranking auditor. It does not recompute market cap, float, or ADV rankings, or verify that the values used were the as-of-date values. It only checks the timestamp you attach to them.
  • Not a delisting-return model. Detecting that delisted names are missing is different from settling their terminal P&L. Use survivorship-bias-free-universe-construction for construction and settlement.
  • Not for live universe construction. As-of machinery reconstructs the past; a live rebalance should read current membership directly.

Prerequisites

  • Point-in-time historical universe constituent records with publication dates.
  • Universe selection filter logic.
  • A single timezone convention across snapshot and record timestamps (UTC recommended). The auditor rejects mixed naive/aware inputs rather than crashing mid-loop.
  • The decision instant of each rebalance (e.g. 09:30 ET on the rebalance date), not just its calendar date.

Workflow

  1. Extract Constituent Timestamps: Record the exact timestamp when symbol membership became known.
  2. Separate Announcement From Effective Date: Populate data_publication_date from the index provider's announcement and the as-of stamp of the ranking data, taking the later of the two. Never copy added_date into it — that makes the look-ahead check unfalsifiable, and the auditor warns when every record does this.
  3. Audit Filter Execution: Assert that selection criteria (market cap, volume) use data strictly preceding backtest date $T$ by passing that data's as-of stamp as data_publication_date. The auditor checks the timestamp, not the values.
  4. Decide the Same-Day Rule Explicitly: A publication timestamp of exactly midnight is date-granular — the real intraday instant was lost upstream, so it cannot establish that the data existed before the session's decision instant. The auditor therefore reads midnight as end of that day by default and flags same-day use as a leak, matching the same-day rule in backtest-database-schema-for-point-in-time-queries. Override with date_granular_publication_is_end_of_day=False only when midnight genuinely means 00:00.
  5. Flag Lookahead Violations: Alert if any constituent added to historical universe relied on post-date data. Gate CI on result.has_violations (hard, deterministic) rather than result.is_clean, which also folds in heuristic warnings.

Full procedure: see references/workflows.md. Standards reference: see references/standards.md. Printable pre-flight checklist: see assets/checklist.md.

Common Pitfalls

  • Retroactive Index Composition: Using 2024 S&P 500 constituents for a 2015 backtest, excluding companies that went bankrupt.
  • Using Un-adjusted Historical Caps: Ranking universe by unadjusted market caps without point-in-time share counts.
  • Publication Date Copied From Effective Date: The single most common way this audit is defeated. Every check passes because the two columns came from the same source column.
  • Midnight Publication Timestamps: A date-only stamp read as 00:00 asserts availability at the very start of the day, which the data never supported. It silently authorises trading on a list that may not have been posted until that evening.
  • Rank Date Mistaken For Knowledge Date: FTSE Russell determines 2026 Russell eligibility from market cap at the close on 30 April, but the preliminary lists are not published until 22 May and take effect after the close on 26 June. Nothing about the new membership is knowable on rank day.
  • Inclusive Removal Dates: The auditor treats membership as half-open [added_date, removed_date). A vendor that stores removed_date as the last day of membership will produce false "Zombie Asset" hits unless you add one session before auditing.
  • Duplicate Membership Intervals: Two overlapping rows for the same ticker silently double-weight the name; the auditor flags this as a violation.
  • Survivorship Heuristic False Positives: A snapshot near the database build date legitimately has zero removals — nothing has been removed yet. The warning is only meaningful for snapshots well in the past.

Verification

  • Submit universe selection with future-dated market caps, verify audit violation flag.
  • Assert that a record published at midnight on the snapshot date is flagged, while the same record published at midnight on the prior date is not.
  • Assert that a name whose added_date equals the snapshot date is treated as a member (changes take effect prior to the open) while one whose removed_date equals it is flagged as a zombie.
  • Assert that a timezone-aware record audited against a naive snapshot raises UniverseAuditError instead of returning a clean result.
  • Run python -m unittest discover -s skills/backtest-look-ahead-in-universe-selection/scripts and confirm 100% pass rate.

Related Skills

  • backtest-database-schema-for-point-in-time-queries
  • survivorship-bias-free-universe-construction
  • point-in-time-index-constituent-tracking
  • lookahead-bias-elimination

Meegeleverde bestanden

Zolang de skill geladen is, leest het model deze bestanden als dat nodig is. Het model kan ze alleen lezen; ze worden nooit uitgevoerd.

Veelgestelde vragen

Wat doet de AI-skill Backtest Look Ahead In Universe Selection?

Gebruik dit wanneer de backtest de effecten selecteert op basis van een regel, zoals de top 50 op marktkapitalisatie of huidig indexlidmaatschap. Controleert tijdstempels van lidmaatschap, zodat je in 2015 niet handelt met de indexsamenstelling van 2026. Lekkage op feature-niveau valt onder lookahead-bias-elimination.

Waarom Backtest Look Ahead In Universe Selection gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Backtest Look Ahead In Universe Selection bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model. Ook als je midden in een chat van model wisselt, blijft de skill werken. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek af te sluiten. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Backtest Look Ahead In Universe Selection in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/backtest-look-ahead-in-universe-selection. TypingMind leest het bestand SKILL.md, bundelt de bijbehorende bestanden en installeert het geheel als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Backtest Look Ahead In Universe Selection gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Backtest Look Ahead In Universe Selection gebruiken?

Zoveel als je wilt. Je kunt Backtest Look Ahead In Universe Selection gebruiken met elk model dat skills ondersteunt, zoals GPT, Claude, Gemini, Grok, DeepSeek, Mistral of Llama. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Backtest Look Ahead In Universe Selection gratis?

Ja. Deze skill is door HimanshuJ16 op GitHub gepubliceerd onder de licentie Apache-2.0. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. De skill volgt het open Agent Skills-formaat: het bestand SKILL.md bevat de naam en beschrijving van de skill. Daarnaast kan de skill scripts, sjablonen of referentiebestanden bevatten die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇