Combine information of DIFFERENT kinds into one research view whose every number can be traced back to what was knowable when. TRIGGER - joining prices to fundamentals, earnings or a macro series; building a signal from a filing plus a price; merging two vendors into one series; "which vendor do I trust"; combine_first / fillna / bfill across sources; assembling a company dossier, profile or research view from several places; a field that must carry its provenance; "when did this number become knowable"; period_end vs filed vs available; a ticker that changed company mid-sample; filling a ResultCard's data block. SKIP for the mechanics of ONE as-of join (safe_asof, in market-data-engineering); for reconciling two price series from two vendors (reconcile_sources, in market-data-sourcing); for auditing a finished backtest (research-integrity-guards); and for resolving a ticker to a permanent id (security-master-and-symbology).
Ships in fin-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Fetching is solved. Finding is solved. Combining is where the number stops being true, because each kind of data arrives on its own clock, in its own convention, under its own identifier — and a join erases all three. Everything below is measured by the two scripts in this skill; nothing here is asserted.
| # | Finding | Measured |
|---|---|---|
| 1 | 🚨 A signal joined on period_end instead of available_at scores 3.37 Sharpe against 1.62. Same panel, same signal, one clock apart — +1.76 of pure look-ahead, 2.1x | scripts/availability_clock.py |
| 2 | 🚨 Taking the EARLIEST input clock is the error that looks fine. The joined row has a price in it, an EPS in it, and no NaN anywhere. Nothing about its shape says half of it was published 53 days later | scripts/availability_clock.py |
| 3 | 🚨 Stamping the join date instead fails SILENTLY — 0 of 1512 sessions carry the fact, so the backtest runs, holds nothing, and reports a flat line rather than an error | scripts/availability_clock.py |
| 4 | 🚨 combine_first resolves by NULLITY, not by precedence. On 2,316 overlapping sessions the two vendors disagree by >10 bps on 171 (7.4%), and b.combine_first(a) takes the non-authoritative number on every one of them, keeping 0 records | scripts/source_merge.py |
| 5 | 🚨 The corrupted series passes every check you actually run: lag-1 autocorrelation −0.055 vs +0.012, annualised vol 20.6% vs 19.2%, and 0 returns beyond 10 sigma. It hands a one-day reversal rule +0.32 Sharpe against −0.38 on the truth | scripts/source_merge.py |
| 6 | 🚨 Splicing two adjustment conventions puts the split on the wrong day — a −49.8% return on a date nothing happened and −0.5% on the date the split actually did; annualised vol 19.2% → 24.9% (1.29x) | scripts/source_merge.py |
| 7 | 🚨 A recycled ticker glues two issuers into one series: a −83.9% one-day return, vol 18.4% → 32.7% (1.77x), and a 60-day momentum rule scoring −0.04 glued against +0.86 on the first issuer alone | scripts/source_merge.py |
| 8 | ✅ The right combine_first order returns the SAME numbers as a precedence merge. The difference is not the values — it is that one of them can tell you it made 171 choices and the other cannot | scripts/source_merge.py |
Three timestamps, and only one of them may decide anything:
| Timestamp | What it is | What it is not |
|---|---|---|
period_end | the period the value describes | ❌ a knowability date. A 30–90 day look-ahead for a filing |
filed_at | when it was filed or released | ❌ tradable. A post-close release is next session's information |
available_at | when it became publicly knowable | ✅ the only one that may enter a signal |
The rule, and it is the whole skill:
A combined fact is knowable only when its LAST input is.
available_at = max(inputs)— nevermin(inputs), and never the date the join ran.
Why min is the seductive error. An earnings yield is a price divided by a fundamental. The
price is known at t. The fundamental describes a quarter that ended weeks ago. Join them on the
fundamental's period end and every column of the output row is populated on date t — a price,
an EPS, no NaN, no warning. The row is a fact about t in every respect except the one that
matters.
✅ Measured (scripts/availability_clock.py, seed 20260910): 40 names, 1,512 sessions, 1,040
quarterly facts, filings knowable 30–76 calendar days after the period ends (median 53), the
market pricing each quarter in over the following 63 sessions — so about 60% of the drift is
over by the median release.
| Clock | What it means | Sharpe | Ann. return |
|---|---|---|---|
period_end (= min inputs) | trade it when the quarter ends | 3.37 | 15.4% |
available_at (= max inputs) | trade it when it is published | 1.62 | 7.4% |
| join date | stamp it with the moment the research ran | 0.00 | 0.0% |
🔑 The cost of the earliest-input clock is +1.76 Sharpe, and it is entirely look-ahead. The join-date clock is the opposite failure: it leaves 0 of 1,512 sessions with a signal and reports that as a flat equity curve, not as an error.
The clock is per FACT, not per join. Prices, filings, macro prints and documents each have their own, and the combined one is the max over whichever inputs that particular field used. That is why it has to travel with the value rather than live in the pipeline.
a.combine_first(b) takes a wherever a is not NaN and b elsewhere. That is not a
precedence rule. A vendor printing a wrong number is not printing a null, so a stale repeat of
yesterday's close, an auction print and a correct quote are all equally "not NaN".
Two consequences, both measured on 2,520 sessions with vendor A missing 204 of them and vendor B complete but carrying 150 stale repeats and 48 bad prints:
b.combine_first(a) — the order you write when B has the better coverage — takes B on all
171, and lands more than 10 bps from the truth on 187 of 2,520 sessions (7.4%).a.combine_first(b) returns the same numbers as a
precedence merge, and is still wrong on the 16 sessions where A had a hole and B filled it
badly. The difference between them is not the values; it is that one can say it made 171
choices.🚨 And the damage is invisible to every check you actually run:
| Series | Ann. vol | max |ret| | >10 sigma | autocorr(1) | 1-day reversal Sharpe |
|---|---|---|---|---|---|
| truth | 19.2% | 534 bps | 0 | +0.012 | −0.38 |
precedence merge (= a.combine_first(b)) | 19.3% | 534 bps | 0 | +0.006 | −0.29 |
naive b.combine_first(a) | 20.6% | 688 bps | 0 | −0.055 | +0.32 |
🔑 A bad print and its snap-back IS negative autocorrelation — which is exactly what a mean-reversion signal is built to find. The artefact adds 1.4 points of annualised vol, produces zero returns beyond 10 sigma, and flips a losing reversal rule into a winning one. There is no outlier filter and no vol check that fires here.
What to do instead: state a ranking before you look at the data, take the highest-ranked source present at each timestamp, and emit a record for every timestamp where the sources differ beyond a stated threshold.
Adjustment differs. A raw series and a split-adjusted one are not two
measurements of one quantity. Measured: splicing them puts a −49.8% return on the switch date
(nothing happened that day) and −0.5% on the day the 2-for-1 split actually occurred;
annualised vol goes 19.2% → 24.9% (1.29x). Re-adjust to one convention first — which
needs the corporate-actions table, and needing it is the point.A ticker is a slot in an exchange's namespace, not a company. It is reassigned after a delisting and it changes on a rename, so joining two vendors on a ticker joins whatever each of them meant by it on each date — a different question from whether their numbers agree.
✅ Measured (scripts/source_merge.py): ticker XYZ is issuer E1 (about $40) for 1,260
sessions, delists, and is reassigned to issuer E2 (about $6) for 1,260 more.
🔑 Resolve to a permanent id (cik, figi, permno, isin) before the join, not after. The
identifier is the only one of the three failure modes that a later check cannot undo, because once
the histories are glued there is nothing in the series that says where the seam was.
fin_skills.synthesis implements all three rules, and refuses rather than guessing.
from fin_skills.synthesis import Dossier, Fact, Timeline, price_fact, MergePolicy, merge_series
from fin_skills.api import check
tl = Timeline([price_fact("close", "cik:0000320193", 189.4, "2024-02-02", source="vendor-a")])
tl.add(Fact(field="revenue", entity="cik:0000320193", value=1.19e11,
period_end="2023-12-30", filed_at="2024-02-01", available_at="2024-02-14",
kind="fundamental", source="edgar"))
ey = tl.combine("earnings_yield", tl.as_of("2024-03-01"), 0.062) # clock = max(inputs)
ey.available_at # 2024-02-14, not 2024-02-02
d = Dossier(entity="cik:0000320193", as_of="2024-03-01", timeline=tl)
print(d.render()) # compact ASCII: value, clock, lag and source per field
print(d.explain("earnings_yield")) # every input, TRANSITIVELY, with the vintage of each
d.provenance_block() # list[DataSource] - the `data=` argument of a ResultCard
print(check(d.to_bundle()).summary()) # the guards run on a SYNTHESISED view
| Call | Refuses |
|---|---|
timeline.combine(...) | an available_at earlier than the last input (AvailabilityError) |
merge_series(sources, policy) | sources whose declared Adjustment differs; an unresolved or mismatched entity; a source nobody ranked (MergeRefused) |
Timeline.check_availability() | — returns the facts some other code path back-dated |
Dossier.explain(field) | — returns the chain, and says when it stops short of a source |
The guard. synthesis_integrity fails on exactly three things: a combined fact claiming an
availability earlier than the latest of its inputs; two merged sources disagreeing beyond the
stated threshold with no Disagreement recorded; and a field whose provenance chain ends at a
root that names no source. It runs from fin_skills.api.check(dossier.to_bundle()).
⚠️ It is excluded from the JSON tool set on purpose: a live Timeline does not survive
json.dumps, and a fabricated one would not be the caller's. Call it from Python.
period_end > available_at — asserted in the tests) but not the magnitudes.filed vs
acceptanceDateTime and FRED's realtime_start, see fundamental-and-macro-data.market-data-engineering — the mechanics of one as-of join: allow_exact_matches,
tolerance, sortedness. That skill is about the join; this one is about what the joined row is
allowed to claim.market-data-sourcing — reconcile_sources, which explains why two price series differ.
Same kind, two sources; this skill starts where the kinds differ or a series has to be produced.research-integrity-guards — the audit of a finished result. This skill is what makes the
data half of a ResultCard fillable without typing it in twice.security-master-and-symbology — resolving an identifier to a permanent entity. §4 measures
what happens if you skip it; that skill is how not to.fundamental-and-macro-data — the vendor-specific clocks (filed vs acceptance, FRED
vintages) that populate a Fact's three timestamps.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/fin-core:combining-data-sourcesfrom fin-core
npx claudepluginhub howard-lynn-ye/fin-rsi --plugin fin-core18 skills in this plugin
/backtesting-enginesChoose a backtesting engine and know what it silently models wrong. TRIGGER - "backtest this", backtest a crossover or a moving-average strategy, simulate a strategy, walk-forward, parameter sweep, "test this trading idea"; comparing or choosing backtest frameworks; vectorbt, backtesting.py, backtrader, zipline, PyBroker, bt, nautilus_trader, LEAN, freqtrade, jesse; how an engine models fills, slippage, commissions; what slippage to assume, partial fills, margin, shorting or delistings; taking a strategy from backtest to live; "my backtest looks too good"; "works in backtest but loses money live". Several popular engines fill at the signal's own bar close by default. SKIP for judging whether a finished result is real (backtest-validation) for A-share rules (china-trading-stack), for crypto funding and perpetuals (crypto-data-and-execution), for options, which need assignment and settlement no engine here models (options-backtesting), and for measuring fills you already have (execution-cost-analysis)./backtest-overfittingDecide whether an edge that passed every mechanical check is still just the best of N tries. TRIGGER - PBO, probability of backtest overfitting, CSCV, combinatorially symmetric cross validation, logit of the out-of-sample rank; minimum backtest length, MinBTL, "how much history do I need", "how many parameter sets can I try on N years of data"; a grid search, Optuna or AutoML picked a winner and it decayed; "in-sample Sharpe 2, live Sharpe 0", "the best parameter set stopped working", "is this peak on my parameter surface real"; pypbo, RiskLabAI CSCV. SKIP for the deflated and probabilistic Sharpe ratios, the trial ledger and SPA/StepM/MCS against a benchmark (backtest-validation); for family-wise error and false-discovery control over a whole research programme (multiple-testing-ledger); for the purged and combinatorial CV splitters themselves (lib-purgedcv); for the mechanical leakage gates that come first (research-integrity-guards); and for regime coverage of the test window (regime-detection)./backtest-validationDecide whether a result survives the number of things you tried. TRIGGER - "I tried N strategies or parameters and the best one..."; overfitting, p-hacking, data snooping, "is this result real", "is this statistically significant"; deflated Sharpe, DSR, PSR, the trial ledger; White's Reality Check, Hansen SPA, StepM, model confidence set, arch.bootstrap; purged or combinatorial cross-validation, embargo, walk-forward, "cross validation on time series without leaking"; a grid search, hyperopt or AutoML picked a winner; triple-barrier labeling, meta-labeling, fractional differentiation, mlfinlab. Load whenever a Sharpe ratio is about to be offered as evidence for trading. SKIP for plain performance metrics - Sharpe, Sortino, CAGR, drawdown (portfolio-and-risk); for PBO, CSCV and the minimum backtest length (backtest-overfitting); and for Bonferroni, Holm, Benjamini-Hochberg or Benjamini-Yekutieli over a ledger of trials (multiple-testing-ledger). The deflated and probabilistic Sharpe ratios are computed HERE./broker-execution-apisConnect to a broker and place orders without accidentally trading live money. TRIGGER - connect to Interactive Brokers, TWS, IB Gateway, ib_async, ib_insync, ibapi, Alpaca, Schwab, schwab-py, Tastytrade, Tradier or Robinhood; place, modify or cancel an order; read positions or balances; set up paper trading; order types, time-in-force, bracket or OCO orders, client order ID; FIX, quickfix, simplefix; "make sure I don't send a live order"; a broker connection being refused. Load before any code that can transmit an order. SKIP for crypto exchanges and ccxt (crypto-data-and-execution), and for vnpy, CTP, QMT or any Chinese broker gateway (china-trading-stack). This skill answers TWS/Gateway port and connection failures on its own - the fin-libraries deep dive is optional and most installs will not have it./derivatives-pricingChoose a derivatives pricing library and get its Greek units and conventions right. TRIGGER - option pricing, implied volatility, IV, Greeks, delta, gamma, vega, theta, rho; which pricing library, exotics coverage; QuantLib, vollib, py_vollib, financepy, rateslib, optionlab; option chains. Greek scaling differs by 100x and 365x between the three common libraries, and one popular fixed-income package is not open source. SKIP for option lifecycle events - assignment, pin risk, expiry - live or backtested, and for historical option chains and vendors (options-backtesting). SKIP for the models themselves - implementing one (option-pricing-models), fitting a smile (implied-vol-surface), building a curve (term-structure-models), bond accrued and the 30/360 family (bond-conventions-and-accrued), duration and DV01 (duration-convexity-and-dv01), and projection-versus-discount choice on a swap (ois-discounting-and-multi-curve)./etf-mechanicsWhy an ETF's price series does not behave like the index it tracks - daily-reset leverage, NAV vs price, distributions, holdings files and fees. TRIGGER - "why is my 3x ETF down when the index is flat", TQQQ decay, SQQQ, leveraged ETF long term, inverse ETF, volatility drag, daily reset; premium to NAV, discount to NAV, iNAV, creation/redemption, "bond ETF trading below NAV"; ETF distribution, capital gains distribution, return of capital, "ETF dropped on the ex-date", phantom drop; ETF holdings file, constituents CSV, index reconstitution, Russell rebalance, "I used today's holdings for the backtest"; expense ratio drag, tracking difference vs tracking error, "ETF returned less than the index". SKIP for downloading price series and vendor adjustment defaults (market-data-sourcing) - holdings files stay here, for UNG, USO or VIXY roll yield and contango (futures-continuous-contracts), for auditing a finished backtest (research-integrity-guards), and for weights, Sharpe or drawdown (portfolio-and-risk).