Fix bot + disable position fetcher
This commit is contained in:
@@ -593,7 +593,6 @@ public class TradingBot : Bot, ITradingBot
|
||||
|
||||
var lastPosition = Positions.LastOrDefault(p => p.IsFinished()
|
||||
&& p.SignalIdentifier != signal.Identifier
|
||||
&& p.ProfitAndLoss.Realized < 0
|
||||
&& p.OriginDirection == signal.Direction);
|
||||
|
||||
if (lastPosition == null)
|
||||
@@ -665,13 +664,9 @@ public class TradingBot : Bot, ITradingBot
|
||||
{
|
||||
if (Positions.Any(p => p.Identifier == position.Identifier))
|
||||
{
|
||||
var previousPosition = Positions.First(p => p.Identifier == position.Identifier);
|
||||
var positionIndex = Positions.IndexOf(previousPosition);
|
||||
position.SignalIdentifier = previousPosition.SignalIdentifier;
|
||||
Positions[positionIndex] = position;
|
||||
SetSignalStatus(position.SignalIdentifier, SignalStatus.Expired);
|
||||
await SetPositionStatus(position.SignalIdentifier, PositionStatus.Finished);
|
||||
Logger.LogInformation(
|
||||
$"Position {position.SignalIdentifier} type correctly close. Pnl on position : {position.ProfitAndLoss.Realized}");
|
||||
$"Position {position.SignalIdentifier} type correctly close. Pnl on position : {position.ProfitAndLoss?.Realized}");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -719,6 +714,7 @@ public class TradingBot : Bot, ITradingBot
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "Error during cancelOrders");
|
||||
SentrySdk.CaptureException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user