Overview
Operator Protocol is the core interface of ClyptQ, standardizing all operations to enable composable and verifiable strategy development.Core Interface
- Pure Functions: Same input → Same output
- Type Safety: TaggedArray for all inputs/outputs
- State Management: Store state in self (lookback, warmup, etc.)
TaggedArray System
All data is represented with 4 fields:- Explicit Missing Data Handling: Distinguish NaN vs missing data
- FFill Tracking: updated=False indicates FFilled value
- Consistent Error Handling: All Operators handle errors the same way
Operator Roles
Operators are classified into 9 roles: 1. ALPHA: Generate predictive signalsComputeGraph
Operators are connected in a DAG to compose strategies:- Automatic Dependency Resolution: Topological sort determines execution order
- Parallel Execution: Independent nodes execute in parallel
- Lookback Management: Automatically provides historical data
Input Specification
Operators declare dependencies using Input objects:Warmup System
Operators automatically handle warmup periods:context.is_warmup: Whether in warmup period_get_warmup_output(): Default output during warmup (usually NaN)- Semantic Operators skip API calls during warmup
Best Practices
1. Maintain Pure FunctionsPerformance Considerations
Operator Execution Cost:- INDICATOR/TRANSFORM: O(N) where N = number of symbols
- ALPHA/FACTOR: O(N × L) where L = lookback
- OPTIMIZER: O(N²) or O(N³) (depends on optimization algorithm)
- SEMANTIC: API latency (100-1000ms)
- Minimize lookback
- Cache expensive computations (store in self)
- Skip Semantic Operators during warmup
- Use vectorized operations (NumPy)
