Make analytics granular - individual tools + selective analyze_report

**Granular Analytics Tools (8 new tools):**
- analyze_monthly_pnl - Monthly profit/loss breakdown
- analyze_drawdown_events - Drawdown events from balance curve
- analyze_top_losses - Top N worst losses with grid depth
- analyze_loss_sequences - Consecutive loss streaks analysis
- analyze_position_pairs - Entry/exit position pairs
- analyze_direction_bias - Long vs Short performance stats
- analyze_streaks - Win/loss streaks with dates
- analyze_concurrent_peak - Peak concurrent open positions

**Updated analyze_report:**
- Now supports selective analytics via 'analytics' array parameter
- Runs all analytics by default (backward compatible)
- Optional top_losses_limit parameter
- Returns list of analytics that were run

**Changes:**
- analytics/analyze.rs: Made all analysis methods public
- tools/definitions.rs: Added 8 new tool definitions + updated analyze_report schema
- tools/handlers/mod.rs: Added dispatch for new tools
- tools/handlers/analysis.rs: Added helper load_report_data() + 8 granular handlers + selective analyze_report logic
This commit is contained in:
Devid HW
2026-04-19 02:13:33 +07:00
parent e94ec8153d
commit 1f63505cb9
4 changed files with 339 additions and 17 deletions
+8
View File
@@ -49,6 +49,14 @@ impl ToolHandler {
// Analysis handlers
"analyze_report" => analysis::handle_analyze_report(&self.config, args).await,
"analyze_monthly_pnl" => analysis::handle_analyze_monthly_pnl(&self.config, args).await,
"analyze_drawdown_events" => analysis::handle_analyze_drawdown_events(&self.config, args).await,
"analyze_top_losses" => analysis::handle_analyze_top_losses(&self.config, args).await,
"analyze_loss_sequences" => analysis::handle_analyze_loss_sequences(&self.config, args).await,
"analyze_position_pairs" => analysis::handle_analyze_position_pairs(&self.config, args).await,
"analyze_direction_bias" => analysis::handle_analyze_direction_bias(&self.config, args).await,
"analyze_streaks" => analysis::handle_analyze_streaks(&self.config, args).await,
"analyze_concurrent_peak" => analysis::handle_analyze_concurrent_peak(&self.config, args).await,
"compare_baseline" => analysis::handle_compare_baseline(&self.config, args).await,
// Set file handlers