πŸ“‹DSL structure

πŸ—οΈ Schema overview

{
  "stream_definition": {
    {
      "name": "string (required)",
      "description": "string (required)",
      "state": [...], // StateConfig[]
      "topic_subscription": {}, // TopicSubscription
      "conditions": [...], // ConditionGroup
      "actions": [...] // Action[]
    }
  }
}

πŸ”„ State configuration

Load data from various sources.

StateConfig schema

{
  "state_name": "string (required)",
  "source": "rocksdb|main_topic (required)",
  "key": "string (required)"
}
Field
Type
Required
Description

state_name

string

βœ…

Variable name to use in conditions

source

enum

βœ…

Data source: rocksdb, main_topic, state_data

key

string

βœ…

Key/path to retrieve data, separate with "."

RocksDB state

Learn more about Rocksdb state β†’

{
  "state_name": "historical_data",
  "source": "rocksdb",
  "key": "column_family#key_name"
}

Main topic data source

Learn more about Main topic β†’

{
  "state_name": "amount",
  "source": "event_data",
  "key": "amount"
}

State data

 "state": [
      {
        "state_name": "mint",
        "source": "event_data",
        "key": "mint"
      },
      {
        "state_name": "token_state",
        "source": "rocksdb",
        "key": "token#t:{mint}"
      },
      {
        "state_name": "total_supply",
        "source": "state_data",
        "key": "token_state.total_supply" // value loaded from token_state, which is persisted in RocksDB
      },
      {
        "state_name": "bonding_progress",
        "source": "state_data",
        "key": "token_state.bonding_progress" // value loaded from token_state, which is persisted in RocksDB
      }
  ]

πŸ“‘ Topic subscriptions

Define which topic to listen to.

TopicSubscription Schema

{
  "topic": "string (required)"
}
Field
Type
Required
Description

topic

string

βœ…

Redpanda topic name

🎯 Conditions

Define when the rule should trigger.

ConditionGroup schema

{
  "type": "all|any (required)",
  "rules": [...] // Condition[]
}
Field
Type
Required
Description

type

enum

βœ…

all (AND) or any (OR)

rules

array

βœ…

Array of conditions

Condition Schema

{
  "state_calculation": "string (required)",
  "operator": "string (required)",
  "value": "any (required)"
}
Field
Type
Required
Description

state_calculation

string

βœ…

Math expression of state in State configuration

operator

enum

βœ…

Comparison operator

value

any

βœ…

Value to compare against

Supported Operators

Comparison operators

  • equals - Exact match

  • greater_than - Numeric >

  • less_than - Numeric <

  • greater_than_or_equal - Numeric >=

  • less_than_or_equal - Numeric <=

String operators

  • contains - String contains substring

  • not_contains - String does not contain

  • starts_with - String starts with

  • ends_with - String ends with

Math Expressions in Conditions

{
  "field": "(current_price - previous_price) / previous_price * 100",
  "operator": "greater_than",
  "value": 10
}

Supported Operations:

  • Arithmetic: +, -, *, /, %

  • Parentheses: (, )

  • Scientific notation: 1.23e-8

  • State variables: current_price, volume

🎬 Actions

Define what to do when conditions are met.

Action schema

{
  "type": "string (required)",
  "config": {...} // HashMap<String, Value>
}
Field
Type
Required
Description

action_type

enum

βœ…

Action type: push_signal, save_state, etc.

data

object

βœ…

Action-specific configuration

Push signal action

{
  "action_type": "push_signal",
  "data": {...}, // SignalData
}

SignalData Configuration

Token Signal:

{
  "action_type": "push_signal",
  "data": {
    "signal_type": "token",
    "mint": "string (token mint address)"
  }
}

Signer Signal:

{
  "action_type": "push_signal",
  "data": {
    "signal_type": "signer",
    "signer": "string (wallet address)"
  }
}

Transaction Signal:

{
  "action_type": "push_signal",
  "data": {
    "type": "transaction",
    "signature": "string (transaction signature)",
    "fee": "number (transaction fee)",
    "program": "string (program ID)",
    "is_buy": "boolean (trade direction)"
  }
}

Last updated