Subscribing Strategies to Streams
A strategy reacts to events that arrive on a data stream. Subscriptions are how you decide which streams a given strategy listens to.
Source vs Stream
These are related, but not the same:
- A data source is the webhook configuration you manage — provider, schema, sample payload, token.
- A data stream is the canonical feed that source resolves to once FORJ has parsed and mapped its payload.
You configure sources; FORJ derives streams from them. Multiple sources can resolve to the same stream when they describe the same instrument, timeframe, venue, and schema identity.
Strategies subscribe to streams, not sources.
Subscribing a Strategy
- In SMITH, open the Strategy Toolbar (gear icon).
- Select Manage Data Sources.
- Browse the streams available in your workspace and select the one or more you want this strategy to listen to.
Once subscribed, events from that stream are routed to the strategy and can drive transitions.
Stream Kinds
| Kind | What it delivers | Example |
|---|---|---|
| Candle series | Standard OHLCV candle data at a regular interval | 5-minute BTCUSD candles from TradingView |
| Event series | Custom event payloads from a webhook | A custom signal from your own system |
Transitions declare which event type they fire on; FORJ matches them to the correct subscribed stream.
Multiple Stream Subscriptions
A strategy can subscribe to more than one stream. This is how you build logic that depends on multiple instruments or timeframes. Each transition can target a specific stream, so the same strategy can react to signals from different feeds.
Cross-Stream Conditions
With multiple subscriptions, guard conditions can compare indicator values across streams directly — for example, a 5-minute EMA against a 1-hour EMA in one condition. Each operand lets you select the triggering stream or any specific subscribed stream as the indicator source.
Stream Priority
Drag streams into the order you want them processed. Each subscribed stream shows a priority number.
When events arrive on multiple streams with the same timestamp, FORJ processes them in priority order — lower numbers first. This gives you control over which feed your strategy sees first when timestamps collide.
Each entry shows its display name, series kind, and identity fields (instrument, timeframe, venue).
Managing Subscriptions
Add or remove subscriptions at any time from the Manage Data Sources panel. Removing a subscription stops further events from that stream being delivered to the strategy.
Event delivery is controlled by the strategy's stream subscriptions, not by metadata fields.