π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)"
}
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)"
}
topic
string
β
Redpanda topic name
π― Conditions
Define when the rule should trigger.
ConditionGroup schema
{
"type": "all|any (required)",
"rules": [...] // Condition[]
}
type
enum
β
all
(AND) or any
(OR)
rules
array
β
Array of conditions
Condition Schema
{
"state_calculation": "string (required)",
"operator": "string (required)",
"value": "any (required)"
}
operator
enum
β
Comparison operator
value
any
β
Value to compare against
Supported Operators
Comparison operators
equals
- Exact matchgreater_than
- Numeric >less_than
- Numeric <greater_than_or_equal
- Numeric >=less_than_or_equal
- Numeric <=
String operators
contains
- String contains substringnot_contains
- String does not containstarts_with
- String starts withends_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>
}
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