internal void Update(XChangeRate xRate) { if (CcyPair.Equals(xRate.CcyPair)) { Rate = xRate.Rate; } else { Rate = 1 / xRate.Rate; } }
public bool Equals(XChangeRate xr, int precision = 8) { if (CcyPair.Equals(xr.CcyPair)) { return(Math.Abs(Rate - xr.Rate) < Math.Pow(10, -precision)); } else { if (CcyPair.Equals(xr.CcyPair.GetInverse())) { return(Math.Abs(Rate - 1 / xr.Rate) < Math.Pow(10, -precision)); } return(false); } }
public string ToString(int precision = 4) { XChangeRate xr = GetCryptoFiatRate(); return($"{Math.Round(xr.Rate, precision)} {xr.CcyPair}"); }