Why components
- Keep strategy files focused on orchestration
- Reuse logic across multiple strategies
- Isolate adapter-specific details behind clean functions
- Make testing simpler by validating component outputs in isolation
1) Create a component
A component usually:- Accepts inputs (symbol, timeframe, thresholds)
- Calls one or more connectors/adapters
- Returns a normalized stream
2) Use a component inside strategy behavior
3) Combine components from multiple venues
This pattern is useful when you want one strategy signal from many data sources.watchFundingPremium() in behavior and attach execution logic when premium crosses your threshold.
Component design tips
- Normalize shapes early (
{ timestamp, symbol, venue, value }) - Keep side effects near strategy behavior (
tap, execution calls) - Prefer small, composable components over one giant pipeline
- Use execution mode checks when behavior should differ in replay/paper/live
Next: Strategy lifecycle
Learn where components fit in
before, behavior, and after execution stages.