Edges
Edges are the connections between nodes that define how data flows through your trading strategy. They represent the pathways along which information travels from one component to another.
What is an Edge?
Section titled “What is an Edge?”An edge connects:
- A source node’s output handle (where data comes from)
- A target node’s input handle (where data goes to)
When data is produced by the source node, it flows along the edge to the target node’s input.
Edge Properties
Section titled “Edge Properties”Source
Section titled “Source”The node and output handle where data originates:
{
"node": "ticker_btc",
"handle": "price"
}Target
Section titled “Target”The node and input handle where data is delivered:
{
"node": "rsi_indicator",
"handle": "value"
}Data Type
Section titled “Data Type”The type of data flowing through the edge (must match source output and target input types).
The current state of the edge:
- Idle: No data flowing
- Active: Data is flowing
- Paused: Temporarily stopped
- Failed: Error in data transmission
Creating Edges
Section titled “Creating Edges”Visual Creation
Section titled “Visual Creation”- Click on a source node’s output handle
- Drag to the target node’s input handle
- Release to create the edge
Type Validation
Section titled “Type Validation”GrailHub validates that:
- Source output type matches target input type
- No circular dependencies are created
- Target input isn’t already connected (unless it accepts multiple connections)
Edge Behavior
Section titled “Edge Behavior”Data Flow
Section titled “Data Flow”When a source node produces output:
- Data is sent along all connected edges
- Target nodes receive the data on their inputs
- Target nodes process the data
- The cycle continues
Buffering
Section titled “Buffering”Edges can buffer data if the target node is busy:
- Default buffer size: 100 items
- Configurable per edge
- Prevents data loss during processing
Backpressure
Section titled “Backpressure”If a target node can’t keep up:
- The buffer fills up
- Source node may slow down or pause
- Prevents memory overflow
Edge Types
Section titled “Edge Types”Data Edges
Section titled “Data Edges”Standard edges that carry data between nodes:
[Price Feed] --price--> [RSI Indicator]Control Edges
Section titled “Control Edges”Edges that control flow execution:
[Condition] --true--> [Execute Trade]
[Condition] --false--> [Log Event]Event Edges
Section titled “Event Edges”Edges that carry event notifications:
[Timer] --tick--> [Fetch Data]Edge Visualization
Section titled “Edge Visualization”Visual Indicators
Section titled “Visual Indicators”Edges display visual cues:
- Solid line: Active connection
- Dashed line: Inactive connection
- Animated dots: Data flowing
- Red color: Error state
- Gray color: Idle state
Edge Labels
Section titled “Edge Labels”Edges can display labels showing:
- Data type
- Current value
- Flow rate
Managing Edges
Section titled “Managing Edges”Selecting Edges
Section titled “Selecting Edges”Click on an edge to select it and view its properties.
Deleting Edges
Section titled “Deleting Edges”Select an edge and press Delete or click the delete icon.
Reconnecting Edges
Section titled “Reconnecting Edges”- Click on the edge’s target end
- Drag to a new target handle
- Release to reconnect
Edge Patterns
Section titled “Edge Patterns”Fan-Out
Section titled “Fan-Out”One source connected to multiple targets:
/--> [Strategy A]
[Price Feed] ---> [Strategy B]
\--> [Strategy C]All strategies receive the same price data.
Fan-In
Section titled “Fan-In”Multiple sources connected to one target:
[Source A] --\
[Source B] ----> [Aggregator]
[Source C] --/The aggregator combines data from multiple sources.
Pipeline
Section titled “Pipeline”Sequential processing:
[A] --> [B] --> [C] --> [D]Data flows through each node in sequence.
Conditional
Section titled “Conditional”Branching based on conditions:
/-true--> [Action A]
[Condition] --
\-false-> [Action B]Different actions based on condition result.
Data Transformation
Section titled “Data Transformation”Type Conversion
Section titled “Type Conversion”Some edges automatically convert data types:
[Number Output] --auto-convert--> [String Input]Data Mapping
Section titled “Data Mapping”Map complex data structures:
[Object Output] --extract field--> [Specific Input]Edge Monitoring
Section titled “Edge Monitoring”Flow Rate
Section titled “Flow Rate”Monitor how much data flows through an edge:
- Messages per second
- Bytes per second
- Average message size
Latency
Section titled “Latency”Track how long data takes to traverse an edge:
- Average latency
- Maximum latency
- Latency distribution
Errors
Section titled “Errors”Monitor edge errors:
- Type mismatches
- Buffer overflows
- Connection failures
Best Practices
Section titled “Best Practices”Keep Flows Simple
Section titled “Keep Flows Simple”Avoid creating overly complex edge patterns. Break into smaller flows if needed.
Use Descriptive Labels
Section titled “Use Descriptive Labels”Label edges to clarify what data they carry.
Monitor Buffer Sizes
Section titled “Monitor Buffer Sizes”Watch for buffer overflows indicating performance issues.
Handle Errors
Section titled “Handle Errors”Always connect error outputs to error handling nodes.
Avoid Circular Dependencies
Section titled “Avoid Circular Dependencies”Circular edges can cause infinite loops and deadlocks.
Test Edge Cases
Section titled “Test Edge Cases”Test what happens when:
- No data flows
- Too much data flows
- Invalid data is sent
Advanced Features
Section titled “Advanced Features”Conditional Edges
Section titled “Conditional Edges”Edges that only activate under certain conditions.
Filtered Edges
Section titled “Filtered Edges”Edges that filter data based on criteria.
Transformed Edges
Section titled “Transformed Edges”Edges that transform data as it flows.
Prioritized Edges
Section titled “Prioritized Edges”Edges with different priorities for data delivery.
Debugging Edges
Section titled “Debugging Edges”Inspecting Data
Section titled “Inspecting Data”Click on an edge to see:
- Current data value
- Data history
- Flow statistics
Breakpoints
Section titled “Breakpoints”Set breakpoints on edges to pause when data flows.
Logging
Section titled “Logging”Enable edge logging to track all data flowing through.