Canli Validation

v0.16.0
io.github.arhancanli/canli-validation-mcp Checked 5 days ago Published 27 days ago

Deflated Sharpe and PBO checks.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_key Get a free validation key

Issue a free validation key for this session. Rarely needed: the first validation issues one itself unless CANLI_KEY or local mode is set, and the read tools need none. Quotas: 1000 validations per key per UTC day, 5 keys per client per UTC day, 1048576 bytes per validation request, 1024 bytes per key revocation request, 20000 observations per series, 200 variants per matrix.

ParameterTypeDescription
labelstringName for the key.

validate_deflated_sharpe Validate deflated Sharpe

Deflated Sharpe ratio: the probability (0 to 1) that the selected strategy's Sharpe beats the best that luck gives across the variants tried, with the probabilistic Sharpe and that luck benchmark. Send the seven statistics or a return series. With every variant's returns use validate_overfitting; luck as a trial count, validate_luck_trials; a multiple-testing haircut, validate_haircut_sharpe. A deflated Sharpe or overfitting probability above or below any threshold is not admission to anything and is not a forecast.

ParameterTypeDescription
cross_trial_sharpe_sd_annualizednumberStandard deviation of annualized Sharpe across those trials.
effective_independent_trialsintegerIndependent variants tried before choosing this one.
non_excess_kurtosisnumberKurtosis, not excess kurtosis; 3 if Normal.
observationsintegerNumber of return observations.
observed_sharpe_annualizednumberAnnualized Sharpe as observed.
periods_per_yearnumberPeriods per year: 252 daily, 365 crypto, 52 weekly, 12 monthly.
returnsarrayPeriodic returns as fractions (0.01 = 1%), oldest first; replaces the Sharpe, observations, skew and kurtosis.
skewnumberSkewness of returns; 0 if Normal.

validate_overfitting Validate overfitting (CSCV)

Probability of backtest overfitting (0 to 1) by CSCV: how often the in-sample best variant falls below the out-of-sample median. Needs every variant's returns (periods by variants); with summary statistics only, use validate_deflated_sharpe. A deflated Sharpe or overfitting probability above or below any threshold is not admission to anything and is not a forecast.

ParameterTypeDescription
matrix *arrayReturns as fractions, one row per period, one column per variant.
max_combinationsintegerMost splits evaluated, up to 2000 (default).
n_splitsintegerEven number of blocks, at least 2; default 16.
seednumberSampling seed; default 42.

validate_reality_check Data-snooping tests (SPA, Reality Check, StepM)

Data-snooping tests on every variant a search tried: Hansen's SPA p-value that the best beat the benchmark only by luck, White's Reality Check, and the variants Romano-Wolf StepM finds better. Send all variants tried, not only the winners. A deflated Sharpe or overfitting probability above or below any threshold is not admission to anything and is not a forecast.

ParameterTypeDescription
alphanumberFamilywise error for StepM; default 0.05.
benchmarkarrayBenchmark return per period; default zero.
block_lengthintegerMean bootstrap block in periods; default round(n^(1/3)).
matrixarrayReturns of every variant the search tried, one row per period, one column per variant.
matrix_filestringPath to a CSV or JSON with one numeric column per variant, instead of matrix.
repsintegerBootstrap draws; default 2000.
seedintegerSampling seed; default 42.

validate_paper_evidence Validate paper evidence

Checks paper-evidence.v0 structure and disclosures. With CANLI_LOCAL=1, record_file reads an export bundle and journal_file verifies signatures, source hashes and recomputed claims. Without a journal, source facts and signatures are unchecked. Local files are never uploaded. This verdict is about the series exactly as submitted. The service never saw the data source, its costs, survivorship, or any lookahead in how the series was built.

ParameterTypeDescription
journal_filestringLocal signed journal to recompute and bind; requires CANLI_LOCAL=1.
recordobjectA canli.paper-evidence.v0 record.
record_filestringLocal record or export-bundle JSON path; requires CANLI_LOCAL=1.
signatureobjectDetached record signature for a signed inline record; requires journal_file.

validate_breadth Validate breadth ceiling

Book Sharpe ceiling from adding sleeves of this quality and correlation, the Sharpe at a sleeve count, and the sleeves a target needs. For portfolio construction; it validates no single strategy. This verdict is about the series exactly as submitted. The service never saw the data source, its costs, survivorship, or any lookahead in how the series was built.

ParameterTypeDescription
average_pairwise_correlation *numberAverage correlation between sleeves, -1 to 1.
sleeve_sharpe *numberAnnualized Sharpe of one sleeve.
sleevesintegerSleeve count, for that book's Sharpe.
targetnumberTarget book Sharpe, for the sleeves it needs.

validate_track_record Minimum track record length

Minimum track record length (observations and years) for an observed Sharpe to beat a benchmark at a confidence level; with observations, the record's probabilistic Sharpe so far. For live or paper records; to size a backtest for its trials, use validate_backtest_length. A deflated Sharpe or overfitting probability above or below any threshold is not admission to anything and is not a forecast.

ParameterTypeDescription
non_excess_kurtosis *numberKurtosis, not excess kurtosis; 3 if Normal.
observed_sharpe_annualized *numberAnnualized Sharpe as observed.
periods_per_year *numberPeriods per year: 252 daily, 365 crypto, 52 weekly, 12 monthly.
skew *numberSkewness of returns; 0 if Normal.
benchmark_sharpe_annualizednumberAnnualized Sharpe to beat; default 0.
confidencenumberBetween 0 and 1; default 0.95.
observationsintegerRecord length so far, for its probabilistic Sharpe.

validate_backtest_length Minimum backtest length

Minimum backtest length (years) before the best of N independent trials is not expected to reach a target Sharpe by luck; with backtest_years, the most trials those years allow. For planning a search; once it has a result, use validate_deflated_sharpe. A deflated Sharpe or overfitting probability above or below any threshold is not admission to anything and is not a forecast.

ParameterTypeDescription
backtest_yearsnumberBacktest length in years, for the most trials it allows.
effective_independent_trialsintegerIndependent trials tried (backtests, parameter sets, ideas).
target_sharpe_annualizednumberIn-sample annualized Sharpe you would call a discovery; default 1.

validate_haircut_sharpe Haircut Sharpe ratio

Haircut Sharpe for multiple testing (Harvey and Liu 2015): the Sharpe a single test would have needed, by Bonferroni and independent tests, and with the other tests' Sharpes, Holm and BHY. For the probability the Sharpe is real, use validate_deflated_sharpe. A deflated Sharpe or overfitting probability above or below any threshold is not admission to anything and is not a forecast.

ParameterTypeDescription
observations *integerReturn observations behind the Sharpe.
observed_sharpe_annualized *numberAnnualized Sharpe as observed.
periods_per_year *numberPeriods per year: 252 daily, 365 crypto, 52 weekly, 12 monthly.
autocorrelationnumberLag-1 autocorrelation of returns, -1 to 1; default 0. Corrects the annualized Sharpe (Lo 2002).
other_sharpe_ratios_annualizedarrayAnnualized Sharpes of the other tests over the same observations; adds Holm and BHY.
testsintegerTests run, this one included; gives the Bonferroni and independent-test haircuts.

validate_luck_trials Luck-equivalent trials

How many skill-less strategies a search would need for its best to reach this Sharpe by luck (Monte Carlo), and with a trial count, the chance it did. States luck as the best of N random tries; for the probability the Sharpe is real, use validate_deflated_sharpe. A deflated Sharpe or overfitting probability above or below any threshold is not admission to anything and is not a forecast.

ParameterTypeDescription
observations *integerReturn observations behind the Sharpe.
observed_sharpe_annualized *numberAnnualized Sharpe as observed.
periods_per_year *numberPeriods per year: 252 daily, 365 crypto, 52 weekly, 12 monthly.
autocorrelationnumberLag-1 autocorrelation of returns, -1 to 1; default 0. Corrects the annualized Sharpe (Lo 2002).
effective_independent_trialsintegerIndependent trials tried; adds the chance the best reached this Sharpe by luck.
skewnumberSkewness; below -0.5 the reading warns the counts are too generous.

audit_backtest Audit a backtest

One-call audit of a strategy's returns. Headline: one test whose false-positive rate was measured on nine return shapes (White's Reality Check with variants, luck trials with Lo's correction without). Then deflated Sharpe, minimum track record and, with variants, overfitting and out-of-sample decay, each with its receipt, plus fix_next. Send every variant tried (variants_file) so trials are counted; point returns_file at a CSV instead of pasting. A deflated Sharpe or overfitting probability above or below any threshold is not admission to anything and is not a forecast.

ParameterTypeDescription
periods_per_year *numberPeriods per year: 252 daily, 365 crypto, 52 weekly, 12 monthly.
benchmark_sharpe_annualizednumberAnnualized Sharpe to beat; default 0.
confidencenumberBetween 0 and 1; default 0.95.
cross_trial_sharpe_sd_annualizednumberStandard deviation of annualized Sharpe across those trials. Optional with variants: measured from them, and the larger is used.
effective_independent_trialsintegerIndependent variants tried before choosing this one. Optional with variants: counted from them, and the larger number is used.
n_splitsintegerEven number of blocks, at least 2; default 16.
returnsarrayPeriodic returns as fractions (0.01 = 1%), oldest first; replaces the Sharpe, observations, skew and kurtosis.
returns_columnColumn name or 1-based position, when returns_file has several numeric columns.
returns_filestringPath to a CSV or JSON of the returns on this machine (not on the hosted endpoint), instead of returns.
variantsarrayOptional returns of every variant tried (this one included), one row per period, one column per variant; adds the overfitting check.
variants_filestringPath to a CSV or JSON with one numeric column per variant, instead of variants.

verify_receipt Verify a receipt

Verify a receipt offline: its Ed25519 signature against the bundled canlicapital.com key, its output hash and its id. Send an id to fetch it first, or the receipt itself. The receipt is content-hashed, reproducible from the open-source core it names, and signed with Ed25519 by a key published at https://canlicapital.com/.well-known/canli-receipt-keys.json.

ParameterTypeDescription
idstringReceipt id from a validation result.
include_receiptbooleanWith id: also return the stored receipt.
receiptobjectA receipt object, to verify without fetching.

service_status Service status

Whether the validation API is up, with its quotas; check after a timeout before resubmitting. No key. This verdict is about the series exactly as submitted. The service never saw the data source, its costs, survivorship, or any lookahead in how the series was built.

backtest_strategy Backtest a rule over a parameter grid, validated

Backtest a rule on your prices over a whole parameter grid, then validate the best with the count of variants actually run: deflated Sharpe, overfitting probability, minimum track record, vs buy and hold, after costs. A backtest, deflated or not, is not a forecast and not advice.

ParameterTypeDescription
family *stringsma_cross (fast, slow), momentum (lookback, skip), mean_reversion (window, entry_z), breakout (lookback), buy_and_hold.
allow_shortbooleanShort instead of flat; default false.
cost_bpsnumberCost per unit of turnover, bps; default 5.
datesarrayOptional ISO dates, one per value.
gridobjectValues per parameter, e.g. {"fast":[10,20],"slow":[50,200]}; every valid combination runs (max 200).
periods_per_yearnumber252 daily (default), 365 crypto, 52 weekly, 12 monthly.
pricesarrayPrices, oldest first.
prices_columnColumn name or 1-based position.
prices_filestringCSV or JSON of prices on this machine; local server only.

summarize_series Summarize a price or return series

A long price or return series in about 100 words plus fields: growth, risk, dated drawdowns, trend, volatility regime, tails, jumps, stale data. Use instead of reading raw bars. Nothing here is a forecast or advice.

ParameterTypeDescription
benchmark_returnsarraySame-period benchmark returns; adds beta.
datesarrayOptional ISO dates, one per value.
namestringLabel for the text.
periods_per_yearnumber252 daily (default), 365 crypto, 52 weekly, 12 monthly.
pricesarrayPrices, oldest first; or returns, or series_file.
returnsarrayReturns as fractions, oldest first.
series_columnColumn name or 1-based position.
series_filestringCSV or JSON of prices or returns on this machine; local server only.
series_kindstringseries_file holds; default prices.

stress_test Stress-test a strategy's returns

Stress a strategy's returns: bootstrap histories (how often the drawdown limit breaks or Sharpe turns negative) and named crash, volatility, repeat and stuck-position scenarios, with a fragility share. Frequencies over resampled histories are not forecasts of the future.

ParameterTypeDescription
blocknumberMean block length; default cube root of n.
crashnumberCrash size, negative; default min(-0.2, 3x worst period).
drawdown_limitnumberFraction; default 0.2.
outage_periodsintegerStuck periods after the worst; default 5.
pathsintegerDefault 1000.
periods_per_yearnumber252 daily (default), 365 crypto, 52 weekly, 12 monthly.
returnsarrayStrategy returns as fractions, oldest first.
returns_columnColumn name or 1-based position.
returns_filestringCSV or JSON of returns on this machine; local server only.
seedintegerDefault 42; reproduces exactly.
volatility_multipliernumberDefault 2.

check_feasibility Check a plan against broker limits and impact

Check a trading plan before it trades: broker order-rate and minimum-order limits, 2026 US day-trading rules, square-root market impact with crowding, and the capital where costs eat the return. Checks the plan as described against published broker limits and a market-impact model; it never contacts a broker or sees an account.

ParameterTypeDescription
adv_usd *numberDaily dollar volume of a typical holding.
capital_usd *number
daily_volatility *numberOf a typical holding, e.g. 0.02.
orders_per_rebalance *integer
rebalances_per_year *number
turnover_per_year *numberBuys plus sells a year / capital.
accountstring
asset_classstring
brokerstringDefault other.
copiesintegerAgents trading the same signal at once; default 1.
expected_gross_returnnumberAnnual, before costs; adds capacity.
impact_coefficientnumberSquare-root law Y; default 1.
minutes_per_rebalancenumberDefault 1.
orders_per_minute_limitnumberIf the broker's is not on file.
spread_and_fees_bpsnumberPer trade; default 0.

check_leakage Check a signal for lookahead

Does a signal look ahead? plan gives cuts; rerun your code on the first cut rows for each, then compare. Rows that changed used later rows; the result names the pattern and horizon. No code is sent. A pass covers only these cuts: the columns are the caller's, and survivorship, vendor revisions or a leak no cut reaches leave no trace.

ParameterTypeDescription
action *string
columnsobjectcompare: {name: {full: [all rows], prefixes: [[first cuts[i] rows], ...]}}, null for missing.
columns_filestringcompare, on your machine: a JSON file {cuts, columns} instead.
cutsarraycompare: plan's cuts.
observationsintegerplan: rows in the series.
prefixesintegerplan: cuts, default 5.
seedinteger
timestampsarray
tolerancenumberDefault 1e-9.

placebo_test Test a research pipeline on placebo data

Does your pipeline find edges in noise? plan writes placebo files (your data's returns in random orders, so nothing is predictable); run the whole pipeline on real.csv and on each, then compare for a p-value that counts every choice it makes. Beating the placebos shows the pipeline finds more in the real order of the returns than in random orders of the same returns; it does not show the edge survives costs, capacity or the future.

ParameterTypeDescription
action *string
columnsobjectplan: {asset: [values]} instead of data_file.
data_filestringplan, on your machine: CSV or JSON, a column per asset, dates optional.
kindstringplan: default prices.
lower_is_betterboolean
methodstring
placebo_resultsarraycompare: its result on each placebo, in file order.
placebosintegerplan: default 19, up to 199.
realnumbercompare: the pipeline's result on the real data.
seedinteger