Update account/position and platform summary
This commit is contained in:
@@ -28,6 +28,7 @@ public static class PostgreSqlMappers
|
||||
|
||||
return new Account
|
||||
{
|
||||
Id = entity.Id,
|
||||
Name = entity.Name,
|
||||
Exchange = entity.Exchange,
|
||||
Type = entity.Type,
|
||||
@@ -45,6 +46,7 @@ public static class PostgreSqlMappers
|
||||
|
||||
return new AccountEntity
|
||||
{
|
||||
Id = account.Id,
|
||||
Name = account.Name,
|
||||
Exchange = account.Exchange,
|
||||
Type = account.Type,
|
||||
@@ -554,7 +556,7 @@ public static class PostgreSqlMappers
|
||||
|
||||
var position = new Position(
|
||||
entity.Identifier,
|
||||
entity.AccountName,
|
||||
entity.AccountId,
|
||||
entity.OriginDirection,
|
||||
entity.Ticker,
|
||||
moneyManagement,
|
||||
@@ -569,6 +571,10 @@ public static class PostgreSqlMappers
|
||||
|
||||
// Set ProfitAndLoss with proper type
|
||||
position.ProfitAndLoss = new ProfitAndLoss { Realized = entity.ProfitAndLoss };
|
||||
|
||||
// Set fee properties
|
||||
position.UiFees = entity.UiFees;
|
||||
position.GasFees = entity.GasFees;
|
||||
|
||||
// Map related trades
|
||||
if (entity.OpenTrade != null)
|
||||
@@ -591,13 +597,15 @@ public static class PostgreSqlMappers
|
||||
{
|
||||
Identifier = position.Identifier,
|
||||
Date = position.Date,
|
||||
AccountId = position.AccountId,
|
||||
ProfitAndLoss = position.ProfitAndLoss?.Realized ?? 0,
|
||||
UiFees = position.UiFees,
|
||||
GasFees = position.GasFees,
|
||||
OriginDirection = position.OriginDirection,
|
||||
Status = position.Status,
|
||||
Ticker = position.Ticker,
|
||||
Initiator = position.Initiator,
|
||||
SignalIdentifier = position.SignalIdentifier,
|
||||
AccountName = position.AccountName,
|
||||
UserId = position.User?.Id ?? 0,
|
||||
InitiatorIdentifier = position.InitiatorIdentifier,
|
||||
MoneyManagementJson = position.MoneyManagement != null
|
||||
@@ -621,10 +629,7 @@ public static class PostgreSqlMappers
|
||||
entity.Price,
|
||||
entity.Leverage,
|
||||
entity.ExchangeOrderId,
|
||||
entity.Message)
|
||||
{
|
||||
Fee = entity.Fee
|
||||
};
|
||||
entity.Message);
|
||||
}
|
||||
|
||||
public static TradeEntity Map(Trade trade)
|
||||
@@ -638,7 +643,6 @@ public static class PostgreSqlMappers
|
||||
Status = trade.Status,
|
||||
TradeType = trade.TradeType,
|
||||
Ticker = trade.Ticker,
|
||||
Fee = trade.Fee,
|
||||
Quantity = trade.Quantity,
|
||||
Price = trade.Price,
|
||||
Leverage = trade.Leverage,
|
||||
|
||||
Reference in New Issue
Block a user