v3.2.0 introduces comprehensive advanced analytics capabilities including portfolio analytics, risk analytics, chart pattern recognition, and additional analytical tools.
- Measures risk-adjusted return
- Annualized calculation
- Configurable risk-free rate
- Measures downside risk-adjusted return
- Only considers negative returns
- Better for asymmetric return distributions
- Calculates peak-to-trough decline
- Includes recovery date tracking
- Percentage and absolute values
- Analyze by strategy
- Analyze by symbol
- Analyze by time period (daily, weekly, monthly, yearly)
- Comprehensive performance metrics
Usage:
from forexsmartbot.analytics import PortfolioAnalytics
analytics = PortfolioAnalytics()
analytics.add_trade(trade)
sharpe = analytics.calculate_sharpe_ratio()
sortino = analytics.calculate_sortino_ratio()
max_dd = analytics.calculate_max_drawdown()- Historical method
- Parametric (variance-covariance) method
- Monte Carlo simulation
- Configurable confidence levels
- Expected shortfall calculation
- Mean of returns below VaR threshold
- More conservative risk measure
- Scenario-based stress testing
- Custom shock percentages
- Loss calculation under stress
- Sharpe ratio
- Sortino ratio
- Calmar ratio
- Information ratio
- Treynor ratio
Usage:
from forexsmartbot.analytics import RiskAnalytics
risk = RiskAnalytics()
risk.add_trade(trade)
var = risk.calculate_var(confidence_level=0.95, method='historical')
cvar = risk.calculate_cvar(confidence_level=0.95)
stress_results = risk.stress_test(scenarios)- Head and Shoulders
- Double Top/Bottom
- Triangles (Ascending, Descending, Symmetrical)
- Flags and Pennants
- Wedges (Rising, Falling)
- Support and Resistance Levels
- Automatic pattern detection
- Confidence scoring
- Pattern type classification (bullish/bearish/neutral)
- Price level identification
Usage:
from forexsmartbot.analytics import ChartPatternRecognizer
recognizer = ChartPatternRecognizer()
patterns = recognizer.detect_patterns(data, lookback=50)- Bid/ask visualization
- Volume at price levels
- Real-time market depth updates
- Multi-currency correlation analysis
- Heatmap visualization
- Average correlation summary
- Configurable lookback period
- Upcoming economic events
- Impact classification (High/Medium/Low)
- Currency filtering
- Date range selection
- Automated trade capture
- Screenshot support
- Notes and annotations
- JSON-based storage
- Trade history browsing
Usage:
from forexsmartbot.analytics import (
MarketDepthProvider, CorrelationAnalyzer,
EconomicCalendarProvider, TradeJournalManager
)
# Market Depth
depth_provider = MarketDepthProvider()
bids, asks = depth_provider.get_depth("EURUSD")
# Correlation
correlation = CorrelationAnalyzer()
correlation_matrix = correlation.calculate_correlation(symbols)
# Economic Calendar
calendar = EconomicCalendarProvider()
events = calendar.get_events(start_date, end_date)
# Trade Journal
journal = TradeJournalManager()
journal.journal_trade(trade, notes="Good trade")- Optimized matplotlib rendering
- Efficient data updates
- Smooth real-time updates
- Optimized data streaming
- Subscriber pattern
- Configurable update intervals
- Thread-safe implementation
- Parallel processing support
- Numba-accelerated calculations
- Cached calculations
- Batch processing
- Seaborn integration for heatmaps
- Enhanced matplotlib charts
- Interactive visualizations
Usage:
from forexsmartbot.services import DataStreamManager, CalculationEngine
# Data Streaming
stream_manager = DataStreamManager(data_provider, update_interval=1.0)
stream_manager.subscribe("EURUSD", callback_function)
stream_manager.start_streaming()
# Calculation Engine
engine = CalculationEngine(use_parallel=True)
results = engine.calculate_indicators_batch(data_list, indicator_func)All analytics modules are integrated into the main application and can be accessed through:
- UI Integration: Analytics widgets available in the main window
- API Access: Direct Python API for programmatic access
- Real-Time Updates: Automatic updates when connected to broker
- Export Capabilities: Export analytics results to CSV/JSON
See examples/v3_2_0_analytics_example.py for comprehensive examples of all features.
New dependencies added:
seaborn>=0.13.0- For correlation heatmapsnumba>=0.59.0- For high-performance calculations
- Chart Rendering: Optimized for 60 FPS updates
- Data Streaming: < 10ms latency
- Calculations: 10-100x faster with numba acceleration
- Memory: Efficient caching reduces memory usage
- Machine learning-based pattern recognition
- Advanced portfolio optimization
- Real-time risk monitoring alerts
- Custom indicator builder
- Backtesting integration with analytics
Version: 3.2.0
Release Date: Q2 2026
Status: ✅ Complete