Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tripolskypetr/pump-anomaly/llms.txt
Use this file to discover all available pages before exploring further.
MetaLedger is a serializable state record that tracks every PumpMatrix.fit() attempt and enforces two invariants against meta-level overfitting — the kind that arises when fit() is called repeatedly inside an automated loop.
The problem: DSR penalises the N configurations tried within a single fit(). But if the loop runs fit() 720 times per month and only promotes the model when certified: true, each “certified” run may itself be the lucky outlier among 720 attempts — a winner’s curse at the meta level. A single-fit certificate is blind to the chain it was selected from.
MetaLedger closes this gap with two mechanisms:
- Cadence guard —
canRefit()refuses a newfit()that comes too soon after the last one. Frequent re-fitting is trial multiplication; the guard simply disallows it. - Family-wise correction — when
metaLedgeris passed tofit(), the DSR’snTrialsbecomeseffectiveTrials— the sum of inner grid sizes across all recorded fit attempts, not just the current one.
MetaLedgerState
The complete state is a plain, JSON-serializable object. Persist it between ticks (write to disk, a database, or environment state).
Ordered list of all fit attempts. Must include every attempt — logging only successes understates the effective trial count and makes the family-wise correction lie.
Unix timestamp in milliseconds when the fit was launched.
Grid size of that fit — the number of configurations evaluated during model selection.
Whether
model.certification.certified was true for that fit. Stored for audit; does not affect the cadence guard or trial count.MetaPolicy and DEFAULT_META_POLICY
MetaPolicy is the cadence-policy interface consumed by canRefit. Both the interface and the default constant are exported from the package.
Minimum milliseconds that must elapse between consecutive
fit() calls. The default of 604_800_000 (7 days) ensures each refit incorporates at least one week of new market data rather than re-drawing on the same history.emptyLedger
MetaLedgerState with an empty attempts array. Call this once when initialising the loop state; then pass the ledger forward on every tick.
{ attempts: [] } — ready to be used as the initial loop state.canRefit
fit() is permitted under the cadence policy. If the ledger is empty (first ever fit), it is always allowed. Otherwise, the function checks whether now ≥ lastFitTs + minRefitMs.
The default minRefitMs is 7 days (7 × 24 × 3600 × 1000 ms). This reflects the idea that a week of new market data is the minimum meaningful increment for retraining a pump-detection model; anything shorter is re-running the same data under a different random draw, which is just trial multiplication.
Current ledger state.
Current Unix timestamp in milliseconds. Pass
Date.now() in production.Cadence policy. Omit to use
DEFAULT_META_POLICY (7-day minimum interval). Pass a custom MetaPolicy to override minRefitMs.Minimum milliseconds between fits. Default:
604_800_000 (7 days).true if a new fit is permitted right now.Human-readable explanation. Examples:
"первый fit"(first fit ever)"интервал выдержан"(interval satisfied)"слишком частый refit: до следующего разрешённого 3.5ч. Частое переобучение размножает испытания (мета-winner's-curse)."(too soon)
Unix timestamp in milliseconds when the next fit will be permitted. Equal to
lastFitTs + minRefitMs, or now on the first fit.recordAttempt
MetaLedgerState with the given attempt appended. The original ledger is not mutated (the function is pure).
You must call recordAttempt for every fit attempt — certified or not. Recording only the successful fits understates the effective number of trials. The family-wise DSR correction only works because the denominator includes all attempts.
Current ledger state.
Unix timestamp of this fit (ms).
Grid size — available as
model.innerTrials after fit() returns.Whether this fit was individually certified —
model.certification.certified.New ledger with the attempt appended. Assign this back to your
ledger variable.effectiveTrials
deflatedSharpe. If the loop has run fit() three times with grids of 500, 480, and 520 configurations, and the current fit used 500 configs, the effective trial count is 500 + 480 + 520 + 500 = 2000 — not 500.
When you pass metaLedger to fit(), the library calls effectiveTrials internally and uses it as nTrials in deflatedSharpe. The result is exposed on the model as model.effectiveTrials.
Current ledger (before the current fit is recorded).
Grid size of the current fit (
model.innerTrials).Total effective trials ≥ 1. Always at least
currentInnerTrials.fitAttemptCount
ledger.attempts.length. Useful for reporting and for manual Bonferroni-style threshold adjustment.
Current ledger state.
Total number of recorded fit attempts.