callbacks.training_telemetry ============================ .. py:module:: callbacks.training_telemetry .. autoapi-nested-parse:: Enhanced telemetry callback for detailed training insights. Tracks portfolio metrics, action distributions, and trading patterns. Classes ------- .. autoapisummary:: callbacks.training_telemetry.TradingTelemetryCallback Module Contents --------------- .. py:class:: TradingTelemetryCallback(verbose = 0, log_freq = 256, action_threshold = 0.1) Bases: :py:obj:`stable_baselines3.common.callbacks.BaseCallback` Custom callback for tracking detailed trading metrics during training. Logs: - Portfolio value and equity changes - Action statistics (buy/sell/hold distribution) - Episode-level metrics (win rate, drawdown) - Per-ticker performance insights .. py:attribute:: log_freq :value: 256 .. py:attribute:: action_threshold :value: 0.1 .. py:attribute:: episode_rewards :type: list[float] :value: [] .. py:attribute:: episode_lengths :type: list[int] :value: [] .. py:attribute:: episode_equity_start :type: list[float] :value: [] .. py:attribute:: episode_equity_end :type: list[float] :value: [] .. py:attribute:: action_history :type: list[numpy.ndarray] :value: [] .. py:attribute:: buy_count :value: 0 .. py:attribute:: sell_count :value: 0 .. py:attribute:: hold_count :value: 0 .. py:attribute:: max_portfolio_value :value: 0 .. py:attribute:: min_portfolio_value .. py:attribute:: cumulative_trades :value: 0 .. py:attribute:: current_episode_start_value :value: None .. py:method:: _on_training_start() Called before the first rollout starts. .. py:method:: _on_rollout_start() Called at the beginning of a new rollout (before collecting data). .. py:method:: _on_step() Called after each step in the environment. :returns: If False, training will be stopped. :rtype: bool .. py:method:: _on_rollout_end() Called at the end of a rollout (after collecting n_steps). This is when PPO does its policy update. .. py:method:: _log_detailed_metrics() Log detailed metrics about training progress. .. py:method:: _on_training_end() Called at the end of training.