一键导入
replicate
Build ETF/fund replication analysis — map holdings to proxies, construct synthetic indices, generate comparison charts, update vault note
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Build ETF/fund replication analysis — map holdings to proxies, construct synthetic indices, generate comparison charts, update vault note
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Autonomous daily market scan: updates market data, screens vault actors for sigma movers (thresholds: docs/movers-screening.md), rolls movers into curated cohorts for a factor-day breadth lens (cohort tape), runs ticker-alias/price-freshness/IPO/private-capital audits, scans the analyst watchlist (docs/analyst-watchlist.md), checks the earnings calendar, and writes the briefing to the daily note and chat. Time-of-day agnostic. Use for /daily-scan, /morning-scan (legacy), daily sweep, what moved today, cohort tape, pre-market check, what's on the earnings calendar.
Deep-dive entity research and note creation pipeline. Use for any entity the user wants a comprehensive vault note on — companies, people, concepts, countries, products. Triggers on /deepdive ENTITY or when the user names an entity and wants thorough research + vault note creation/expansion. The skill adds SEC filing protocols, full chart sets, stale-reference scanning, and entity-type branching that CLAUDE.md's general vault instructions don't sequence.
Market-reaction measurement for listed-company events. Use when /ingest, /news, /earnings, event notes, actor notes, or securities notes need event-specific stock reaction adjusted for market, sector, and peer moves, with raw move, abnormal move, residual sigma, raw sigma, and abnormal/raw sigma outputs. Applies to after-close/pre-open announcements, intraday catalysts, M&A-adjacent events, financings, product launches, regulatory decisions, customer wins/losses, and peer read-throughs.
Full earnings ingestion pipeline for a ticker: check market_data.db, find the latest quarterly results, INSERT with the DB's field conventions, regenerate fundamentals/sankey/waterfall charts, update actor + daily notes. Use whenever the user mentions earnings, quarterly results, income statement data, inserting fundamentals, fixing EPS or financial data in the DB, or asks if a ticker's earnings are current. Also triggers on /earnings TICKER.
Plain-language briefing on a vault topic for a reader unfamiliar with the actors and subtopics — same cross-vault read as /report, journalistic-explainer voice with first-mention introductions and glosses. Use for /explain TOPIC, a primer / briefing / explainer, or 'what's the situation with X' for someone not steeped in the threads. NOT for new research (/deepdive), vault-reader synthesis (/report), or daily wrap-ups (/newsletter).
Single-source ingestion pipeline: process one source (interview, podcast, article, video, filing, screenshot set) into the vault — acquisition, full entity/data-point enumeration, classification gates, image routing, note creation/expansion, daily-note logging. Use whenever the user provides a URL, transcript, or screenshots for vault processing. Triggers on /ingest, a pasted YouTube/article URL, 'ingest this', 'process this interview', 'add this to the vault'.
| name | replicate |
| description | Build ETF/fund replication analysis — map holdings to proxies, construct synthetic indices, generate comparison charts, update vault note |
Build a replication of a multi-asset ETF or fund using tradeable proxies. Usage: /replicate TICKER
The goal is to decompose what an ETF actually holds and replicate its returns using liquid instruments the user could trade directly. This reveals hidden exposures, hedging gaps, and whether the fund's fee is justified.
python scripts/check_before_create.py "TICKER"
SELECT COUNT(*), MIN(Date), MAX(Date) FROM stock_prices_daily WHERE "TICKER" IS NOT NULL;
If missing, add it: python scripts/add_ticker.py TICKER"TICKER holdings" site:ssga.com OR site:ishares.com OR site:vanguard.comExtract the fund's actual holdings into asset classes. Standard taxonomy:
For each holding, identify the best tradeable proxy:
Proxy selection hierarchy (prefer higher):
Build the holdings-to-proxy mapping table. Format for the vault note:
| Fund holding | Notional | ETF proxy | Futures proxy | Key mismatch |
|---|---|---|---|---|
| S&P 500 E-Mini | $XXM | SPY / SPLG | ES=F | Minimal |
| Euro-Bund Future | $XXM | BNDX (hedged) | IBGL.L + EURUSD=X | Currency hedge |
Ensure all proxy tickers are in the database:
python scripts/add_ticker.py PROXY1 PROXY2 PROXY3
For international instruments not in the wide table, use yfinance directly:
import yfinance as yf
df = yf.Ticker("^STOXX50E").history(start="2020-01-01", end="2026-12-31")
Store to prices_long via replication_utils.store_ticker().
Create scripts/create_TICKER_repl.py following the established pattern. The script should use shared utilities from scripts/replication_utils.py:
from replication_utils import (
get_prices, compute_returns, build_index,
interpolate_schedule, store_ticker
)
Standard replication tiers (build progressively):
leverage * return - (leverage - 1) * daily_rateinterpolate_schedule()Script structure:
def main():
store = '--store' in sys.argv
# 1. Get prices
prices_df = get_prices(ALL_TICKERS, start_date=START_DATE)
# 2. Compute returns
returns = compute_returns(prices_df, ALL_TICKERS)
dates = prices_df['Date'].values
# 3. Get anchor price
# (fetch actual fund price at base_date for initial_price)
# 4. Build each tier
tier1_vals = build_index(dates, returns, STATIC_WEIGHTS,
base_date=BASE_DATE, initial_price=anchor)
tier2_vals = build_index(dates, returns, dynamic_weights,
leverage=lev_array, base_date=BASE_DATE,
initial_price=anchor)
# 5. Store
if store:
store_ticker(result_df, 'Date', 'TICKER_REPL', 'TICKER_REPL',
'TICKER Static Replication')
# ... repeat for each tier
# 6. Print comparison
# Show returns for fund vs each replication tier
Run with --store to persist: python scripts/create_TICKER_repl.py --store
Produce the standard 4-chart set. All charts go in investing/attachments/.
Compare actual fund vs all replication tiers, normalized to 100 at inception.
curl -o "investing/attachments/TICKER-replication-comparison-chart.png" \
"http://localhost:5000/api/chart/lw?tickers=TICKER,TICKER_REPL,TICKER_REPL_DYN&start=START&normalize=true&primary=TICKER"
If the chart server isn't running, use Flask test client or matplotlib directly.
Rolling correlation of each replication vs the actual fund. Use matplotlib:
from replication_utils import rolling_correlation
corr_df = rolling_correlation(prices_df, 'TICKER', ['TICKER_REPL', 'TICKER_REPL_DYN'])
Save as TICKER-rolling-correlation-chart.png.
Line chart of each asset class's notional exposure over time, plus NAV dashed line.
Only possible if NAV/AUM data is available. Save as TICKER-notional-evolution-chart.png.
Line chart of each asset class as % of gross notional. This is always possible if weight history exists.
Save as TICKER-notional-pct-chart.png.
Chart verification: Always check file size (wc -c) — files under 1KB are errors, not PNGs.
Add a ## Replication analysis section to the fund's actor note with:
Results table:
| Method | Total return | vs TICKER | Notes |
|--------|-------------|-----------|-------|
| TICKER (actual) | +X.XX% | — | Reference |
| Tier 1 (static 1x) | +X.XX% | X.XXpp | Baseline |
| Tier 2 (dynamic + lev) | +X.XX% | X.XXpp | Time-varying weights |
Holdings-to-proxy mapping table (from Phase 1)
Charts with captions:
![[TICKER-replication-comparison-chart.png]]
*Normalized comparison of TICKER vs replication tiers since inception...*
Gap analysis paragraph: Explain what the residual is — rebalancing alpha, roll yield, instrument mismatch, currency effects, cash collateral yield. Quantify where possible using the progressive tier comparison (what each improvement closed).
python scripts/check_note_compliance.py investing/Actors/TICKER.md
prices_long (narrow format) for storing synthetic tickers — the wide table is at column limitTICKER_REPL (static), TICKER_REPL_DYN (dynamic), TICKER_REPL_FUT (futures proxy)scripts/replication_utils.py — use them. Don't duplicate build_index, compute_returns, store_ticker in new scripts.