Fix trade status
This commit is contained in:
@@ -407,6 +407,12 @@ public class TradingBotBase : ITradingBot
|
||||
{
|
||||
internalPosition.Open.SetStatus(TradeStatus.Filled);
|
||||
}
|
||||
|
||||
// Also update the position in the bot's positions dictionary
|
||||
if (positionForSignal.Open != null)
|
||||
{
|
||||
positionForSignal.Open.SetStatus(TradeStatus.Filled);
|
||||
}
|
||||
|
||||
if (internalPosition.Status.Equals(PositionStatus.New))
|
||||
{
|
||||
@@ -428,6 +434,12 @@ public class TradingBotBase : ITradingBot
|
||||
{
|
||||
internalPosition.Open.SetStatus(TradeStatus.Filled);
|
||||
}
|
||||
|
||||
// Also update the position in the bot's positions dictionary
|
||||
if (positionForSignal.Open != null)
|
||||
{
|
||||
positionForSignal.Open.SetStatus(TradeStatus.Filled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -506,6 +518,12 @@ public class TradingBotBase : ITradingBot
|
||||
internalPosition.Open.SetStatus(TradeStatus.Filled);
|
||||
}
|
||||
|
||||
// Also update the position in the bot's positions dictionary
|
||||
if (positionForSignal.Open != null)
|
||||
{
|
||||
positionForSignal.Open.SetStatus(TradeStatus.Filled);
|
||||
}
|
||||
|
||||
await SetPositionStatus(signal.Identifier, PositionStatus.Filled);
|
||||
|
||||
// Notify platform summary about the executed trade
|
||||
@@ -768,6 +786,12 @@ public class TradingBotBase : ITradingBot
|
||||
{
|
||||
internalPosition.Open.SetStatus(TradeStatus.Filled);
|
||||
}
|
||||
|
||||
// Also update the position in the bot's positions dictionary
|
||||
if (positionForSignal.Open != null)
|
||||
{
|
||||
positionForSignal.Open.SetStatus(TradeStatus.Filled);
|
||||
}
|
||||
|
||||
// Save updated position to database
|
||||
await tradingService.UpdatePositionAsync(internalPosition);
|
||||
|
||||
Reference in New Issue
Block a user