Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Common/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ public class Holding
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public decimal UnrealizedPnL;

/// Current unrealized P/L % of the holding
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public decimal UnrealizedPnLPercent;

/// Create a new default holding:
public Holding()
{
Expand All @@ -124,6 +128,7 @@ public Holding(Security security)
AveragePrice = Math.Round(holding.AveragePrice, rounding);
MarketPrice = Math.Round(holding.Price, rounding);
UnrealizedPnL = Math.Round(holding.UnrealizedProfit, 2);
UnrealizedPnLPercent = Math.Round(holding.UnrealizedProfitPercent * 100, 2);
}

/// <summary>
Expand All @@ -140,6 +145,7 @@ public Holding Clone()
MarketPrice = MarketPrice,
MarketValue = MarketValue,
UnrealizedPnL = UnrealizedPnL,
UnrealizedPnLPercent = UnrealizedPnLPercent,
ConversionRate = ConversionRate,
CurrencySymbol = CurrencySymbol
};
Expand Down