Refactor TradingBotBase to streamline recovery logic for recently canceled positions. Removed redundant recovery call and added comments for clarity in position management.
This commit is contained in:
@@ -372,6 +372,9 @@ public class TradingBotBase : ITradingBot
|
||||
|
||||
private async Task ManagePositions()
|
||||
{
|
||||
// Recovery Logic: Check for recently canceled positions that might need recovery
|
||||
await RecoverRecentlyCanceledPositions();
|
||||
|
||||
// Early exit optimization - skip if no positions to manage
|
||||
// Optimized: Use for loop to avoid multiple iterations
|
||||
bool hasOpenPositions = false;
|
||||
@@ -400,8 +403,7 @@ public class TradingBotBase : ITradingBot
|
||||
if (!hasOpenPositions && !hasWaitingSignals)
|
||||
return;
|
||||
|
||||
// Recovery Logic: Check for recently canceled positions that might need recovery
|
||||
await RecoverRecentlyCanceledPositions();
|
||||
|
||||
|
||||
// First, process all existing positions that are not finished
|
||||
// Optimized: Inline the filter to avoid LINQ overhead
|
||||
|
||||
Reference in New Issue
Block a user