public decimal GetTotalPercentage(CoinMarketTicker ticker, UserCoin coin) { if (ticker == null || ticker.Market != UserTickerMarket) { return(0); } return((ticker.Last * coin.Quantity) / user.UserSummary.TotalBalance * 100m); }
public decimal GetProfitPercentage(CoinMarketTicker ticker, UserCoin coin) { if (ticker == null || coin.BuyPrice == 0 || ticker.Market != UserTickerMarket) { return(0); } return((ticker.Last - coin.BuyPrice) / coin.BuyPrice * 100m); }