When running pump-anomaly in production you need signals that are safe to act on immediately — no peeking at candles that haven’t closed yet, no manual veto logic, no inversion flags to interpret.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.
plan() is the live execution method: it fetches 1 m candles strictly before the signal, evaluates the liquidation-cascade detector on that past window, and returns a flat list of TradeSignal objects that your order router can execute without any additional decision logic.
Three Execution Methods
The three methods differ only in which candles they are allowed to see and what they return:| Method | Candles | Use |
|---|---|---|
signals(items, policy?) | none | Fast path; cascade not evaluated; every outcome is enter |
plan(items, source, policy?) | before the signal (live-safe, no look-ahead) | Live decision |
backtest(items, source, policy?) | after the signal (forward replay) | Replay over closed history |
plan and backtest each accept either a GetCandles function (async, returns a Promise) or a { symbol: candles } map (sync, returns TradeSignal[] directly).
plan() in Detail
The look-ahead guarantee comes fromsqueezePressureBefore, which measures cascade pressure only over candles with timestamps before the entry candle. plan() requests exactly lookbackMinutes of 1 m history ending at the signal minute — it never requests a candle whose open time is at or after the entry start.
Internally, plan() computes entryStartTs(signal.ts, "1m") to find the first fully-closed tradeable candle, then pulls [entryStart − lookback · 60 000, entryStart) from your candle source. No forward candle is ever fetched or examined.
TradeSignal[] shape. The async overload is for prod systems with a live exchange adapter; the sync overload is useful in tests or when you prefetch candles yourself.
TradeSignal Contract
Every element returned byplan() (and signals()) is a single executable decision. The flat execution fields are always valid; the origin object is for audit only — production code should never branch on it.
direction is always the final direction. When action is "invert", the channel posted short but the cascade detector flipped it to long — your order router still just executes s.direction. origin.invertedFrom tells you what the channel said, for logging.
Execution Pattern
The intended production loop is exactly one statement per signal:s.direction is ready. s.exit is ready. s.entryFromPrice / s.entryToPrice come directly from the ParserItem; if absent, enter at market. There are no flags to evaluate before calling openPosition.
lookbackMinutes
model.lookbackMinutes tells you exactly how much 1 m candle history plan() needs per signal:
model.lookbackMinutes minutes of 1 m history available for every symbol that may appear in a fresh signal. If the candle source returns nothing for a symbol (data gap, unlisted pair), plan() degrades gracefully to a no-candle signal rather than crashing the whole call.
planFor() for Single Positions
When you need a one-off live signal for a single position rather than a batch, useplanFor():
planFor() constructs a synthetic verdict from the last candle’s timestamp and runs the same live-mode cascade check. It returns null if the result is vetoed or the resulting action is excluded by the policy. Use it for manual entries or external signal sources that aren’t ParserItem[].
Risk-Reward Filter
The runtime policy can filter out symbols whose backtested risk-reward ratio falls below a threshold. This filter is read-only: it can only narrow what training already permitted.rrMetric selects which statistic to compare: "mean" (default), "p95", or "p99". A symbol with no RR statistics is cut conservatively — nothing to confirm it with. A runtime minRiskReward can only tighten the baked-in threshold (the max of the two is used), never loosen it.
A broken symbol — data gap, unlisted pair, look-ahead guard at the end of history — causes
plan() to degrade gracefully to a no-candle signal (cascade not evaluated, volRegime: null) instead of throwing and aborting the whole batch. The rest of the signals in the batch are unaffected.