Releases: brandonschabell/alphaflow
Releases · brandonschabell/alphaflow
v0.3.0
Immutable
release. Only release title and notes can be modified.
Added
on_missing_priceconfig option - control behavior whenget_price()cannot find data:"raise"(default),"warn", or"ignore"PolarsDataFeed- Load historical data directly from Polars DataFrames
Changed
- Replaced
Makewithjustfor development commands - Relaxed dependency version requirements.
- Replace
mypywithtyfor type checking.
Deprecated
CSVDataFeed- UsePolarsDataFeedinstead for loading data from CSV files
v0.2.0
Immutable
release. Only release title and notes can be modified.
Added
- Polygon.io Data Feed - New data source supporting daily and intraday market data
.envFile Support - Store API keys securely without committing them to version control- Rate Limit Handling - Automatic retry with configurable backoff for API rate limits (HTTP 429 errors)
- Slippage Models - Pluggable slippage modeling with
FixedSlippageModelfor basis point slippage - Commission Models - Three commission types: fixed per trade, per share, and percentage-based
- Transaction Cost Analytics - DefaultAnalyzer now tracks slippage and commission costs
- Python 3.14 - Adds support for python 3.14
Changed
- BREAKING: Replaced
pandaswithpolarsfor improved performance (CSVDataFeed API unchanged) - BREAKING: Replaced
seaborn/matplotlibwithplotlyfor interactive visualizations - Examples now automatically load API keys from
.envfile - Added
python-dotenv>=1.0.0dependency SimpleBrokeraccepts optionalslippage_modelandcommission_modelparameters
Fixed
- Timestamp handling now works correctly across all system timezones
v0.1.1
Immutable
release. Only release title and notes can be modified.
Fixed
- FMPDataFeed: Fixed compatibility with Financial Modeling Prep's new API endpoint. Users with free FMP accounts created after August 31, 2025 can now use the data feed.
v0.1.0
Immutable
release. Only release title and notes can be modified.
Added
- Event-Driven Architecture: Complete pub-sub event bus implementation with priority-based event queue
EventBuswith immediate and queued publishing modesEventQueuewith chronological ordering and priority levels- Proper event ordering ensures MarketData → Order → Fill sequence
- Core Components:
AlphaFlow- Main backtest engineStrategy- Base class for trading strategiesBroker- Base class for order executionDataFeed- Base class for market data providersPortfolio- Position and cash tracking with performance calculationsAnalyzer- Base class for performance analysis
- Built-in Strategies:
BuyAndHoldStrategy- Rebalancing strategy with target weights, quantization, and minimum trade thresholds
- Built-in Brokers:
SimpleBroker- Basic order execution with margin support and commission handling
- Built-in Data Feeds:
CSVDataFeed- Load historical data from CSV filesAlphaVantageFeed- Integration with Alpha Vantage APIFMPDataFeed- Integration with Financial Modeling Prep API
- Built-in Analyzers:
DefaultAnalyzer- Comprehensive performance metrics including:- Sharpe Ratio
- Sortino Ratio
- Maximum Drawdown
- Annualized Return
- Total Return
- Benchmark comparison
- Portfolio value visualization
- Event Types:
MarketDataEvent- OHLCV price barsOrderEvent- Trading orders (market/limit, buy/sell)FillEvent- Trade executions with commissions
- Features:
- Benchmark comparison (e.g., SPY for S&P 500)
- Commission tracking and deduction
- Margin trading support with buying power calculations
- Flexible timestamp handling (datetime objects or ISO strings)
- Position tracking and portfolio valuation
- Configurable backtest time periods
- Data caching for performance
- Testing:
- 97 comprehensive unit tests
- 92% code coverage
- Full CI/CD pipeline with GitHub Actions
- Documentation:
- Complete Getting Started guide
- API reference documentation
- Architecture overview
- Contributing guidelines
- ReadTheDocs integration
Technical Details
- Event comparison protocol for chronological sorting
- Type hints throughout the codebase
- Strict mypy type checking
- Ruff linting and formatting
- Python 3.10+ support (3.10, 3.11, 3.12, 3.13)
Known Limitations
- Single timeframe support (daily/intraday bars)
- No partial fills (fills are immediate and complete)
- No slippage modeling (planned for v0.2)
- No advanced order types (stop-loss, take-profit, etc.)
- No multi-asset portfolio optimization tools
- Limited to stocks/ETFs (futures, forex, crypto, options coming in future versions)
Dependencies
pandas- Data handlinghttpx- Modern HTTP client for API data feedsseaborn- Visualizationmatplotlib(via seaborn) - Plotting