← Back to Radar

RADAR / SCRIPT API · v1

Radar script strategies

Turn your observation rules into JavaScript. Preview against current tokens before enabling.

Full API reference and examples, ready for your LLM.

Quick start

Running strategies requires an active Max membership or higher. This reference is available to everyone.

  1. Open Script strategy in the Radar filter bar.
  2. Choose Extend or Replace. Edit the JavaScript source, or load the example.
  3. Click Preview (Ctrl / ⌘ + Enter). Compare available tokens, UI matches and script matches. Inspect JSON for up to 10 included and 5 excluded samples.
  4. Click Apply & enable. Editing the source or mode requires a fresh preview. Disable script & use UI restores normal filters immediately.

The editor supports JavaScript highlighting, line numbers, bracket matching, folding and undo/redo. Tab moves keyboard focus; use spaces for indentation. If the editor fails to load, a plain text editor remains available.

Execution modes

extend · Extend
All UI conditions run first, including search and annotations, followed by filter(). A script cannot bring back a token excluded by the UI.
replace · Replace
The script controls all filtering. Call ctx.matchesUI() to retain UI conditions selectively.

Only the main list is affected. Group view and Search All temporarily bypass the script. Graduation, pinned annotations and event alerts use their existing rules. Scripts only see tokens Radar has received; they cannot recover data excluded by the server.

Hooks & context

Export at least one of these named functions. Omitted filter() keeps candidates; omitted priority() uses zero. Every hook must run synchronously.

HookReturn value
filter(token, ctx)boolean; true keeps the token
priority(token, ctx)Finite number; higher comes first
compare(a, b, ctx)Finite number; negative puts a first, positive puts b first, zero falls back to UI sorting

Ordering is priority descending → compare → UI sort. Inputs, including nested objects and arrays, are read-only.

ctx.version
API version, currently 1.
ctx.now
One Unix millisecond timestamp shared by all hooks in this evaluation.
ctx.filters
Read-only UI configuration. Every property is listed below.
ctx.matchesUI(overrides = {})
Available in filter and priority, for the current token. Top-level overrides are merged into the UI configuration: null clears numeric limits, [] clears platform/annotation restrictions, and search: "" clears search. Existing AND/OR, missing-value and precise quantity/percentage rules are reused.
ctx.compareUI(a, b, mode = ctx.filters.sort)
Available in all three hooks. Pass the provided token objects to reuse a UI sort mode.

Examples

Extend: low market cap, recent buys first

export function filter(token, ctx) {
  return ctx.matchesUI() && token.marketCapUsd !== null &&
    token.marketCapUsd < 5000;
}

export function priority(token) {
  return token.recentBuy5m ? 1 : 0;
}

export function compare(a, b, ctx) {
  return ctx.compareUI(a, b, "last-buy-desc");
}

Replace: override token age for external markets

Internal markets retain all UI conditions. External markets require an age over 720 minutes and an ATL gain up to 20%, while clearing the UI token age range. Other UI conditions, including active trading minutes, remain in effect.

export function filter(token, ctx) {
  if (!token.isExternal) return ctx.matchesUI();
  return token.ageMinutes !== null && token.ageMinutes > 720 &&
    ctx.matchesUI({
      minTokenAgeMinutes: null,
      maxTokenAgeMinutes: null,
      maxAtlGainPercent: 20,
    });
}

All token fields (37)

Unknown numbers are null; check explicitly before comparison. Timestamps use Unix milliseconds; percentages use 20 for 20%. For exact thresholds prefer ctx.matchesUI(). Raw amounts can also be compared with BigInt(lastTradeAmountRaw) and tokenDecimals.

FieldTypeMeaning / unit
tokenstringToken contract address
namestringToken name
symbolstringToken symbol
platformstringOriginal platform: pons-v2 / pump / otc / long
filterPlatformstringUI platform group; otc is grouped under pump
pairTokenstring | nullQuote token address
pairTokenSymbolstring | nullQuote token symbol
websitestring | nullWebsite URL
twitterstring | nullOriginal X URL
xProfilestring | nullX profile URL validated by Radar
annotationstring | nullAnnotation: scam / star / watch / bad; null if unmarked
qualifiedboolean | nullWhether quality checks passed; null if unknown
isMayhemboolean | nullWhether Mayhem mode is enabled
isWashTradingboolean | nullWhether small-trade activity was detected
dexPaidbooleanConfirmed Dex paid promotion; false if unconfirmed
boostedbooleanConfirmed Boost; false if unconfirmed
isInternalbooleanInternal market; unknown Long stages are not inferred as internal
isExternalbooleanExternal market, using platform stage rules
launchedAtnumber | nullLaunch time, Unix milliseconds
graduatedAtnumber | nullGraduation time, Unix milliseconds
ageMinutesnumber | nullMinutes from launch to this evaluation
activeTradingMinutesnumber | nullObserved minute buckets with trades, not continuous trading duration
marketCapUsdnumber | nullMarket capitalization in USD
volume24hUsdnumber | null24-hour volume in USD
totalTaxPercentnumber | nullTotal tax, 20 means 20%; null for Pump / OTC / Long
athDrawdownPercentnumber | nullDrawdown from ATH, 20 means 20%
atlGainPercentnumber | nullGain from ATL, 20 means 20%
lastTradeSide"buy" | "sell" | nullLast trade direction
lastTradeAtnumber | nullLast trade time, Unix milliseconds
lastBuyAtnumber | nullLast observed buy time, Unix milliseconds
recentBuy5mbooleanBuy within 5 minutes, with 30 seconds of future clock tolerance
recentTrade5mbooleanTrade within 5 minutes, with 30 seconds of future clock tolerance
lastTradeAmountRawstring | nullRaw integer token amount for the last trade group; uses group total when available
tokenDecimalsnumberToken decimals; defaults to 18 when absent
lastTradeAmountMillionsnumber | nullLast trade group amount in millions of tokens; floating-point approximation
lastTradeCountnumber | nullTrade count in the last group; defaults to 1 for a known trade
lastTradeUsdnumber | nullLast trade group value in USD

All ctx.filters fields (40)

Pass these keys to ctx.matchesUI() as overrides. Numeric ranges include both boundaries; null disables a boundary. Time ranges use minutes; amount and percentage units are shown below. Tax filters retain the UI exemption for Pump / OTC / Long.

FieldTypeMeaning / unit
searchstringSearch query; empty string clears search
sortstringUI sort mode; see the sort table
strategyobjectCurrent strategy: enabled (boolean), mode (extend / replace), source (string); overriding it does not change the current execution
websiteQuerystringWebsite URL query
xQuerystringX URL query
linkRegexbooleanUse regular expressions for link queries
minLastTradeAmountMillionsnumber | nullMinimum last trade group amount in millions; UI uses integer comparison
minLastTradeCountnumber | nullMinimum last trade group count (nonnegative integer)
minLastTradeUsdnumber | nullMinimum last trade group value in USD
lastTradeBuybooleanRequire the last trade to be a buy
recentBuybooleanRequire a buy within 5 minutes
recentTradebooleanRequire a trade within 5 minutes
lastTradeWithinstringLast trade window, e.g. 5m / 2h / 1d; empty string disables
lastBuyWithinstringLast buy window, e.g. 5m / 2h / 1d; empty string disables
minVolume24hUsdnumber | nullMinimum 24-hour volume in USD
maxVolume24hUsdnumber | nullMaximum 24-hour volume in USD
minMarketCapUsdnumber | nullMinimum market capitalization in USD
maxMarketCapUsdnumber | nullMaximum market capitalization in USD
minTokenAgeMinutesnumber | nullMinimum token age in minutes
maxTokenAgeMinutesnumber | nullMaximum token age in minutes
minActiveTradingMinutesnumber | nullMinimum active trading minutes
maxActiveTradingMinutesnumber | nullMaximum active trading minutes
timeRangeRelation"and" | "or"Relationship between age and active trading conditions
minTotalTaxPercentnumber | nullMinimum total tax percentage
maxTotalTaxPercentnumber | nullMaximum total tax percentage
minAthDrawdownPercentnumber | nullMinimum ATH drawdown percentage
maxAthDrawdownPercentnumber | nullMaximum ATH drawdown percentage
minAtlGainPercentnumber | nullMinimum ATL gain percentage
maxAtlGainPercentnumber | nullMaximum ATL gain percentage
xProfileOnlybooleanRequire a valid X profile URL
hideUnqualifiedbooleanHide tokens failing quality checks
hideMayhembooleanHide Mayhem tokens
hideWashTradingbooleanHide tokens with small-trade activity
dexPaidOnlybooleanRequire confirmed Dex paid promotion
boostedOnlybooleanRequire confirmed Boost
graduatedOnlybooleanShow external markets only
ungraduatedOnlybooleanShow internal markets only
selectedPlatformsstring[]Platform allowlist: pons-v2 / long / otc / pump; UI groups OTC under Pump; [] removes restriction
selectedAnnotationsstring[]Include annotations: scam / star / watch / bad; [] removes restriction
hiddenAnnotationsstring[]Exclude annotations: scam / star / watch / bad; [] removes restriction

Sort modes

ctx.compareUI(a, b, mode) · ctx.filters.sort

modeOrder
defaultNewest launch first
age-descOldest tokens first
active-minutes-descMost active trading minutes first
market-cap-descMarket cap high to low (in original quote units)
market-cap-ascMarket cap low to high (in original quote units)
last-trade-descMost recent trade first
last-trade-ascOldest trade first
last-buy-descMost recent buy first

Unknown sort names fall back to default. Optional missing values sort last; ties fall back to launch time descending, then contract address.

Saving & runtime

  • The strategy is saved with browser filters. Reloading rechecks membership. Templates and JSON backups include the strategy; importing or loading them always keeps scripts disabled until preview and enable.
  • Export current input JSON downloads all UI settings and the current token facts, useful for inspecting fields and debugging.
  • Active scripts reevaluate on data updates and once per second. Membership is rechecked at least every 15 seconds while running; losing access disables the strategy.
  • Scripts run synchronously in an isolated Worker with QuickJS/WASM. DOM, network, browser storage, external imports and asynchronous hooks are unavailable.
  • Limits: 50,000 source characters, 32 MiB interpreter memory, 512 KiB stack and 500 ms execution budget. The Worker is terminated after 5 seconds without a response.
  • On execution failure the last successful list is preserved and an error is shown. Fix the script, preview and apply again, or disable it. New tokens may expose errors that a preview did not encounter.