How edtechre/pybroker works
PyBroker is a Python algorithmic-trading framework. A user configures a Strategy with a data source, symbols, and trading rules or models; Strategy loads historical bars, prepares indicators and model predictions, invokes execution callbacks through a per-bar context, and records simulated orders and portfolio results. Walkforward analysis and parameter optimization extend that workflow, while evaluation, caching, parallel execution, and multi-interval data support it. Relationships below rely on README statements and SOURCE INDEX references; unsampled implementation details are not inferred.
Main entry points: strategy.py Strategy engine · indicator.py Indicators · model.py Model training · data.py Historical data
Components 19
Market data
- Historical data
src/pybroker/data.py - Provider adapters
src/pybroker/ext/data.py - Interval compression
src/pybroker/interval.py
Strategy runtime
- Strategy engine
src/pybroker/strategy.py - Indicators
src/pybroker/indicator.py - Vectorized functions
src/pybroker/vect.py - Model training
src/pybroker/model.py - Execution context
src/pybroker/context.py - Orders and portfolio
src/pybroker/portfolio.py - Slippage models
src/pybroker/slippage.py
Analysis and tuning
- Performance evaluation
src/pybroker/eval.py - Parameter optimization
src/pybroker/optimize.py - AI agent skills
skills
Runtime support
- Runtime data scopes
src/pybroker/scope.py - Data and model cache
src/pybroker/cache.py - Parallel execution
src/pybroker/parallel.py - Strategy configuration
src/pybroker/config.py - Shared data types
src/pybroker/common.py
Other components
- Strategy author
Connections 22
- Strategy author → Strategy engine: configures
README.md - Strategy engine → Historical data: loads bars
src/pybroker/strategy.py - Provider adapters → Historical data: provides data
src/pybroker/ext/data.py - Strategy engine → Interval compression: prepares intervals
src/pybroker/strategy.py - Strategy engine → Indicators: computes indicators
src/pybroker/strategy.py - Indicators → Vectorized functions: uses functions
src/pybroker/indicator.py - Strategy engine → Model training: trains models
src/pybroker/strategy.py - Strategy engine → Execution context: invokes callbacks
src/pybroker/strategy.py - Execution context → Orders and portfolio: accesses positions
src/pybroker/context.py - Strategy engine → Orders and portfolio: simulates orders
src/pybroker/strategy.py - Strategy engine → Slippage models: adjusts fills
src/pybroker/strategy.py - Strategy engine → Performance evaluation: evaluates results
src/pybroker/strategy.py - Strategy engine → Parameter optimization: optimizes parameters
src/pybroker/strategy.py - Strategy engine → Runtime data scopes: uses runtime scopes
src/pybroker/strategy.py - Historical data → Data and model cache: caches data
src/pybroker/data.py - Indicators → Data and model cache: caches indicators
src/pybroker/indicator.py - Model training → Data and model cache: caches models
src/pybroker/model.py - Indicators → Parallel execution: dispatches work
src/pybroker/indicator.py - Model training → Parallel execution: dispatches work
src/pybroker/model.py - Strategy engine → Strategy configuration: uses settings
src/pybroker/strategy.py - Strategy engine → Shared data types: uses shared types
src/pybroker/strategy.py - Strategy author → AI agent skills: gets guidance
README.md