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()
|
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
|
// Early exit optimization - skip if no positions to manage
|
||||||
// Optimized: Use for loop to avoid multiple iterations
|
// Optimized: Use for loop to avoid multiple iterations
|
||||||
bool hasOpenPositions = false;
|
bool hasOpenPositions = false;
|
||||||
@@ -400,8 +403,7 @@ public class TradingBotBase : ITradingBot
|
|||||||
if (!hasOpenPositions && !hasWaitingSignals)
|
if (!hasOpenPositions && !hasWaitingSignals)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Recovery Logic: Check for recently canceled positions that might need recovery
|
|
||||||
await RecoverRecentlyCanceledPositions();
|
|
||||||
|
|
||||||
// First, process all existing positions that are not finished
|
// First, process all existing positions that are not finished
|
||||||
// Optimized: Inline the filter to avoid LINQ overhead
|
// Optimized: Inline the filter to avoid LINQ overhead
|
||||||
|
|||||||
Reference in New Issue
Block a user