Skip to content

Commit a56d80d

Browse files
TexasCodingclaude
andcommitted
fix(stats): Resolve typing conflicts between memory stats methods
- Renamed get_memory_stats to get_enhanced_memory_stats in EnhancedStatsTrackingMixin - Avoids conflict with MemoryManagementMixin's get_memory_stats method - Updated all references in StatisticsAggregator to use enhanced version - All mypy type checks now pass 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f17ffc5 commit a56d80d

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/project_x_py/utils/enhanced_stats_tracking.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,9 @@ async def get_data_quality_stats(self) -> dict[str, Any]:
335335
"invalid_rate": (invalid / total) if total > 0 else 0.0,
336336
}
337337

338-
async def get_memory_stats(self) -> dict[str, Any]:
338+
async def get_enhanced_memory_stats(self) -> dict[str, Any]:
339339
"""
340-
Get memory usage statistics with automatic sampling.
340+
Get enhanced memory usage statistics with automatic sampling.
341341
342342
Returns:
343343
Dictionary with memory statistics
@@ -400,7 +400,7 @@ async def export_stats(self, format: str = "json") -> dict[str, Any] | str:
400400
"performance": await self.get_performance_metrics(),
401401
"errors": await self.get_error_stats(),
402402
"data_quality": await self.get_data_quality_stats(),
403-
"memory": await self.get_memory_stats(),
403+
"memory": await self.get_enhanced_memory_stats(),
404404
"component_specific": self._sanitize_for_export(self._component_stats),
405405
}
406406

src/project_x_py/utils/statistics_aggregator.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,9 @@ async def _get_order_manager_stats(self, uptime_seconds: int) -> ComponentStats:
214214

215215
# Get memory usage
216216
memory_mb = 0.0
217-
if hasattr(om, "get_memory_stats"):
217+
if hasattr(om, "get_enhanced_memory_stats"):
218218
try:
219-
memory_stats = await om.get_memory_stats()
219+
memory_stats = await om.get_enhanced_memory_stats()
220220
memory_mb = memory_stats.get("current_memory_mb", 0.0)
221221
except Exception as e:
222222
logger.warning(f"Failed to get OrderManager memory stats: {e}")
@@ -278,9 +278,9 @@ async def _get_position_manager_stats(self, uptime_seconds: int) -> ComponentSta
278278

279279
# Get memory usage
280280
memory_mb = 0.0
281-
if hasattr(pm, "get_memory_stats"):
281+
if hasattr(pm, "get_enhanced_memory_stats"):
282282
try:
283-
memory_stats = await pm.get_memory_stats()
283+
memory_stats = await pm.get_enhanced_memory_stats()
284284
memory_mb = memory_stats.get("current_memory_mb", 0.0)
285285
except Exception as e:
286286
logger.warning(f"Failed to get PositionManager memory stats: {e}")
@@ -445,8 +445,8 @@ async def _get_risk_manager_stats(self, uptime_seconds: int) -> ComponentStats:
445445
error_count = 0
446446

447447
# Get memory usage
448-
if hasattr(rm, "get_memory_stats"):
449-
memory_stats = await rm.get_memory_stats()
448+
if hasattr(rm, "get_enhanced_memory_stats"):
449+
memory_stats = await rm.get_enhanced_memory_stats()
450450
memory_mb = memory_stats.get("current_memory_mb", 0.0)
451451
elif hasattr(rm, "get_memory_usage_mb"):
452452
memory_mb = rm.get_memory_usage_mb()

0 commit comments

Comments
 (0)