fix position initiator + pnl for trade
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Concurrent;
|
||||
using Managing.Domain.Users;
|
||||
using Managing.Domain.Users;
|
||||
using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Domain.Bots
|
||||
@@ -16,10 +15,12 @@ namespace Managing.Domain.Bots
|
||||
public int Interval { get; set; }
|
||||
public BotStatus Status { get; set; }
|
||||
public User User { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The time when the bot was started
|
||||
/// </summary>
|
||||
public DateTime StartupTime { get; private set; }
|
||||
|
||||
private CancellationTokenSource CancellationToken { get; set; }
|
||||
|
||||
public Bot(string name)
|
||||
@@ -62,14 +63,15 @@ namespace Managing.Domain.Bots
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SentrySdk.CaptureException(ex);
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
}, CancellationToken.Token);
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
catch (TaskCanceledException ex)
|
||||
{
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"Bot was cancelled: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +96,7 @@ namespace Managing.Domain.Bots
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total runtime of the bot since it was started
|
||||
/// </summary>
|
||||
@@ -103,7 +105,7 @@ namespace Managing.Domain.Bots
|
||||
{
|
||||
if (Status != BotStatus.Up || StartupTime == DateTime.MinValue)
|
||||
return TimeSpan.Zero;
|
||||
|
||||
|
||||
return DateTime.UtcNow - StartupTime;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Managing.Domain.MoneyManagements;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Managing.Domain.MoneyManagements;
|
||||
using Managing.Domain.Users;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Domain.Trades
|
||||
@@ -34,7 +34,7 @@ namespace Managing.Domain.Trades
|
||||
[Required] public PositionStatus Status { get; set; }
|
||||
public string SignalIdentifier { get; set; }
|
||||
[Required] public string Identifier { get; set; }
|
||||
[Required] public PositionInitiator Initiator { get; }
|
||||
[Required] public PositionInitiator Initiator { get; set; }
|
||||
[Required] public User User { get; set; }
|
||||
|
||||
public bool IsFinished()
|
||||
|
||||
Reference in New Issue
Block a user