public decimal SellPrice(Kraken.Asset asset, decimal amount, decimal feeLinear) { if (this.IsBase(asset)) { decimal result = BidPrice * amount; return(result.AddPercentage(-feeLinear)); } else if (this.IsQuote(asset)) { decimal taxfree = amount.FindValueByPercentages(100m - feeLinear, 100m); return(taxfree / BidPrice); } throw new Exception("Specified assed is not falid for this ticker."); }
public static decimal AddPercentage(this decimal value, decimal?percentage) { return(value.AddPercentage(percentage.IsNotNull() ? percentage.Value : 0)); }