Skip to content

Flows

A flow is the fundamental building block of GrailHub. It represents a complete trading strategy or automation as a visual diagram.

A flow is a directed graph consisting of:

  • Nodes: Instances of components that perform specific tasks
  • Edges: Connections between nodes that define data flow
  • Configuration: Settings that control the flow’s behavior

Create your flow by dragging components onto the canvas and connecting them together.

Configure each node with the appropriate settings for your strategy.

GrailHub validates your flow to ensure:

  • All required inputs are connected
  • Data types match between connected nodes
  • No circular dependencies exist

When you run a flow:

  1. GrailHub initializes all nodes
  2. Data begins flowing through the edges
  3. Each node processes data and produces outputs
  4. The flow continues until stopped or an error occurs

Continuous flows run indefinitely, processing data as it arrives:

[Market Data] → [Indicator] → [Strategy] → [Execution]

Example: A trading bot that monitors market conditions and executes trades.

Scheduled flows run at specific times or intervals:

[Timer] → [Data Fetch] → [Analysis] → [Report]

Example: A daily portfolio rebalancing strategy.

Event-driven flows trigger based on specific conditions:

[Price Monitor] → [Condition] → [Alert]

Example: A price alert system.

Each flow has a state that indicates its current status:

  • Draft: Flow is being designed
  • Ready: Flow is validated and ready to run
  • Running: Flow is actively executing
  • Paused: Flow execution is temporarily stopped
  • Stopped: Flow execution has ended
  • Failed: Flow encountered an error

You can start a flow in several ways:

  1. Manual Start: Click the “Run” button
  2. Scheduled Start: Configure a schedule
  3. API Start: Trigger via the REST API

Flows can be stopped:

  1. Manual Stop: Click the “Stop” button
  2. Automatic Stop: When a terminal node is reached
  3. Error Stop: When an unrecoverable error occurs

Pause a flow to temporarily halt execution without losing state. Resume to continue from where it left off.

Monitor your flows in real-time:

  • Node States: See which nodes are active, idle, or failed
  • Data Flow: Watch data move through edges
  • Logs: View detailed execution logs
  • Metrics: Track performance metrics like execution time and throughput

Break complex strategies into multiple smaller flows that can be composed together.

Name your flows and nodes clearly to make them easy to understand.

Use comment nodes to document your strategy and explain complex logic.

Build and test your flow one component at a time.

Always include error handling nodes to gracefully handle failures.

Keep an eye on execution time and resource usage.

Create reusable subflows that can be used as components in other flows.

Use flow variables to store and share data between nodes.

Some flows support parallel execution for improved performance.

Use condition nodes to create different execution paths based on data.