> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memeperfect.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Strategy Rules Spec

> How to format the simplified rules[] payload for create/update strategy API calls.

Use this page when building `POST /strategies` or `PATCH /strategies/:id` payloads programmatically.

Send rules as a single flat `rules` array. MemePerfect organizes them into the correct strategy sections automatically.

## Request shape

Create and update use this external rule shape:

```json theme={null}
{
  "rule": "liquidity_usd",
  "dealbreaker": false,
  "min": 10000
}
```

Rule fields:

* `rule`: required string. Must be an exact supported rule id.
* `dealbreaker`: required boolean. Marks whether this rule is treated as a dealbreaker.
* `enabled`: optional boolean. `enabled: false` skips any rule type.
* `min`: optional number. Used only for numeric rules.
* `max`: optional number. Used only for numeric rules.
* `value`: optional string. Used only for enum rules such as `risk_level` and `launch_platform`.
* `operator`: optional string. Used only for enum rules. Allowed values: `equals`, `not_equals`. Defaults to `equals` when omitted.
* `config`: optional object. Used only for advanced market, volume/activity, and wallet-quality rules.
* `clusterConfig`: optional object. Used only for coordinated wallet cluster rules.

<Warning>
  Unknown rule ids fail hard. Wrong field types or wrong field combinations fail hard with a clear error message that includes the blocking `rules[index]`.
</Warning>

<Warning>
  These rules cannot be used as dealbreakers:

  * Website Shows CA
  * Website Contains \$Token Name
  * Website Content Validity Score
  * X Link Contains CA
  * X Link Contains \$Token Name
  * X Views
  * X Followers
  * X Community Size
  * X Community Views
  * X (Twitter) Content Validity Score
  * Coordinated Wallet Cluster
  * Quality Wallets
  * Quality Wallet Buy Value
  * Quality Wallet Win Rate
</Warning>

## Rule-kind behavior

### Boolean rules

Use `enabled` only.

* `enabled: true` applies the rule.
* `enabled: false` skips the rule.
* `min`, `max`, and `value` are not allowed.

Boolean payload example:

```json theme={null}
{ "rule": "is_honeypot", "dealbreaker": true, "enabled": true }
```

### Numeric rules

Use `min` and/or `max`.

* At least one of `min` or `max` is required.
* `min` and `max` must be non-negative finite numbers.
* If both are present, `max` must be greater than `min`.
* `enabled` is not allowed unless you are using `enabled: false` to skip the rule.
* `value` is not allowed.
* Internally, `min` maps to `greater_than`, `max` maps to `less_than`.

Numeric payload examples:

```json theme={null}
{ "rule": "liquidity_usd", "dealbreaker": false, "min": 10000 }
```

```json theme={null}
{ "rule": "dev_wallet_percent", "dealbreaker": true, "min": 5, "max": 20 }
```

### Enum rules

* `value` is required.
* `operator` is optional. Allowed values: `equals`, `not_equals`. If omitted, MemePerfect defaults to `equals`.
* `enabled` is not allowed.
* `min` and `max` are not allowed.

Supported enum rules:

* `risk_level`
  * Allowed values: `CRITICAL`, `HIGH`, `MEDIUM`, `LOW` (case-insensitive input accepted).
  * Important behavior: `risk_level` is treated like a threshold. For example, `equals: LOW` matches only `LOW`, while `equals: HIGH` matches `HIGH`, `MEDIUM`, and `LOW`.
* `launch_platform`
  * Allowed values: `pump_fun`, `letsbonk_fun`, `bags_fm`, `rapidlaunch`, `raydium_launchlab`, `dexlab`, `meteora`
  * Behavior: exact enum match for both `equals` and `not_equals`.

Enum payload example:

```json theme={null}
{ "rule": "risk_level", "dealbreaker": true, "value": "LOW" }
```

```json theme={null}
{ "rule": "launch_platform", "dealbreaker": false, "operator": "not_equals", "value": "pump_fun" }
```

### Object rules

Object rules use `config` because one rule can contain several settings or presets.

* `volume_24h` accepts age-aware volume windows through `config.windows`.
* `buy_sell_ratio_window` accepts `config.window` and `config.buyPressure`.
* `validated_volume_spike` accepts `config.window` and `config.volumeSpike`.
* `quality_wallet_count`, `quality_wallet_total_value`, and `quality_wallet_min_winrate` accept wallet-quality settings through `config`.
* `enabled: false` skips the rule.
* `min`, `max`, and `value` are not allowed with these rules.

Volume windows example:

```json theme={null}
{
  "rule": "volume_24h",
  "dealbreaker": false,
  "config": {
    "windows": {
      "5m": 5000,
      "1h": 10000,
      "6h": 25000,
      "24h": 50000
    }
  }
}
```

Buy pressure example:

```json theme={null}
{
  "rule": "buy_sell_ratio_window",
  "dealbreaker": false,
  "config": {
    "window": "1h",
    "buyPressure": "moderate"
  }
}
```

Allowed `buyPressure` values:

* `off`
* `slight`
* `moderate`
* `strong`
* `aggressive`

Volume spike example:

```json theme={null}
{
  "rule": "validated_volume_spike",
  "dealbreaker": false,
  "config": {
    "window": "5m",
    "volumeSpike": "very_strong"
  }
}
```

Allowed `volumeSpike` values:

* `off`
* `noticeable`
* `strong`
* `very_strong`
* `explosive`

Wallet-quality examples:

```json theme={null}
{
  "rule": "quality_wallet_count",
  "dealbreaker": false,
  "config": {
    "minWallets": 5,
    "walletTypes": ["smart_wallet", "kol", "whale", "profitable_trader"]
  }
}
```

```json theme={null}
{
  "rule": "quality_wallet_total_value",
  "dealbreaker": false,
  "config": {
    "minTotalValueUsd": 5000,
    "walletTypes": ["smart_wallet", "whale"]
  }
}
```

```json theme={null}
{
  "rule": "quality_wallet_min_winrate",
  "dealbreaker": false,
  "config": {
    "minWinratePct": 60,
    "minWalletsAboveThreshold": 3,
    "walletTypes": ["smart_wallet", "profitable_trader"]
  }
}
```

Allowed `walletTypes` values:

* `smart_wallet`
* `kol`
* `whale`
* `profitable_trader`

<Info>
  `quality_wallet_total_value` compares the combined token buy value from qualifying wallets. It is not a current-holdings-only rule.
</Info>

### Cluster rules

Coordinated wallet cluster checks use `clusterConfig`.

```json theme={null}
{
  "rule": "coordinated_wallet_cluster",
  "dealbreaker": false,
  "clusterConfig": {
    "maxTotalHeldPct": 20,
    "maxSingleClusterPct": 10,
    "maxClusterRisk": "high"
  }
}
```

Allowed `maxClusterRisk` values:

* `low`
* `medium`
* `high`
* `very_high`

## PATCH clear behavior

`PATCH /strategies/:id` supports full replacement semantics for `rules`.

* Omit `rules` to keep the strategy's saved rules unchanged.
* Send `rules: []` to clear the strategy's saved rules.
* `POST /strategies` still requires a non-empty `rules` array.

## Trigger update semantics

`PATCH /strategies/:id` uses replacement semantics for `triggers` too.

* Omit `triggers` to keep existing triggers unchanged.
* Send `triggers` to replace the strategy's saved triggers.

## Full create payload example

```json theme={null}
{
  "name": "API Strategy Example",
  "description": "Built from integration service",
  "strict": true,
  "alertCooldownMins": 30,
  "retryPolicy": {
    "type": "QUICK_RETRY",
    "maxAttempts": 3,
    "delayMinutes": 15
  },
  "matching": {
    "enabled": true,
    "minPercent": 80
  },
  "triggers": ["new_token_created"],
  "rules": [
    { "rule": "is_honeypot", "dealbreaker": true, "enabled": true },
    { "rule": "has_freeze_authority", "dealbreaker": true, "enabled": true },
    { "rule": "risk_level", "dealbreaker": true, "value": "LOW" },
    { "rule": "liquidity_usd", "dealbreaker": false, "min": 10000 },
    { "rule": "market_cap", "dealbreaker": false, "max": 1500000 },
    {
      "rule": "volume_24h",
      "dealbreaker": false,
      "config": {
        "windows": {
          "5m": 5000,
          "1h": 10000,
          "6h": 25000,
          "24h": 50000
        }
      }
    },
    {
      "rule": "buy_sell_ratio_window",
      "dealbreaker": false,
      "config": {
        "window": "1h",
        "buyPressure": "moderate"
      }
    },
    {
      "rule": "quality_wallet_count",
      "dealbreaker": false,
      "config": {
        "minWallets": 5,
        "walletTypes": ["smart_wallet", "kol", "whale", "profitable_trader"]
      }
    },
    {
      "rule": "coordinated_wallet_cluster",
      "dealbreaker": false,
      "clusterConfig": {
        "maxTotalHeldPct": 20,
        "maxSingleClusterPct": 10,
        "maxClusterRisk": "high"
      }
    },
    { "rule": "has_twitter", "dealbreaker": false, "enabled": true },
    { "rule": "website_content_validation_score", "dealbreaker": false, "min": 50 }
  ],
  "isActive": false
}
```

## Supported rule ids

Supported rule ids:

### Security

`is_honeypot`, `is_mintable`, `top_10_holder_percent`, `dev_wallet_percent`, `is_lp_locked`, `risk_level`, `rugged`, `lp_locked_pct`, `has_freeze_authority`, `has_high_ownership`, `has_top10_high_ownership`, `has_single_holder_ownership`, `has_creator_rug_history`, `has_low_lp_providers`, `has_low_liquidity`, `creator_has_multiple_tokens`, `has_creator_balance`, `has_lockers`, `risk_count`, `token_mutable`, `has_transfer_fee`, `token_age`

<Info>
  `token_age` is evaluated in minutes.
</Info>

<Warning>
  Breaking change: on March 11, 2026, `token_age` runtime semantics moved from hours to minutes. Existing persisted thresholds were not auto-migrated.
</Warning>

### Market

`sell_tax`, `buy_tax`, `liquidity_usd`, `market_cap`, `kols`, `global_fees_paid`, `pro_traders`, `snipers`, `insiders`, `bundle`, `dev_migrations`, `dev_pairs_created`, `bonding_progress`, `launch_platform`, `is_pump`, `holder_count`

### Volume/Activity

`volume_24h`, `tx_count`, `num_buys`, `num_sells`, `buy_sell_ratio_window`, `validated_volume_spike`, `quality_wallet_count`, `quality_wallet_total_value`, `quality_wallet_min_winrate`

### Clusters

`coordinated_wallet_cluster`

### Socials

`has_website`, `has_telegram`, `has_twitter`, `at_least_one_social`, `website_has_ca`, `website_contains_token_name`, `twitter_link_has_ca`, `x_link_contains_token_name`, `twitter_effective_views`, `x_community_member_count`, `x_community_views_count`, `twitter_effective_followers`

### AI

`website_content_validation_score`, `x_content_validation_score`

<CardGroup cols={2}>
  <Card title="APIs" icon="code" href="/developers/apis">
    Full external API endpoint reference.
  </Card>

  <Card title="Data Point Glossary" icon="book-open" href="/reference/data-point-glossary">
    Human-readable meaning of each rule and metric.
  </Card>
</CardGroup>
