// Sold end value. Full value of the coin you've sold. For example, Bought for $100, sold for $120. Returns $120. private decimal GetGeneratedSoldEndValue() { decimal profit = TotalSoldPricePaidUSD.GetValueOrDefault(); if (profit == 0 || TotalPricePaidUSD.GetValueOrDefault() == 0) { return(0); } // If TotalBoughtPrice is 0, it's a transfer coin. Not sure of profit. if (DisplayCurrency == Types.CoinCurrency.USD) { return(profit); } if (DisplayCurrency == Types.CoinCurrency.BTC) { return((profit / OrderedDateUSDPriceOfBTC).ToDecimalPrecision(8)); } if (DisplayCurrency == Types.CoinCurrency.ETH) { return((profit / OrderedDateUSDPriceOfETH).ToDecimalPrecision(6)); } if (DisplayCurrency == Types.CoinCurrency.EUR) { return(profit.UsdToEuro()); } return(0); }
public decimal GenerateCurrentTotalPriceInUSD() { if (TotalPricePaidUSD.GetValueOrDefault() == 0 || TotalSoldPricePaidUSD.GetValueOrDefault() == 0) { return(0); } return(TotalSoldPricePaidUSD.Value - TotalPricePaidUSD.Value); }
public decimal CalculateSoldPercentageChange() { if (TotalPricePaidUSD.GetValueOrDefault() == 0 || TotalSoldPricePaidUSD.GetValueOrDefault() == 0) { return(0); } var change = TotalSoldPricePaidUSD - TotalPricePaidUSD; var percentageChange = (change / TotalPricePaidUSD) * 100; return(percentageChange.GetValueOrDefault()); }