public static bool IsCurrency(this Asset asset) { if (asset == null) { return(false); } return(Kraken.IsCurrency(asset.GetEnumName())); }
public static string ToString(Tuple <Asset, Asset> values, AssetToupleFormat format = AssetToupleFormat.NamesSeparated) { if (values == null) { return(null); } Asset _base = values.Item1; Asset _quote = values.Item2; string sb = _base.GetEnumName(); string sq = _quote.GetEnumName(); string sbd = _base.GetEnumDescription(); string sqd = _quote.GetEnumDescription(); string sbc = IsCurrency(_base) ? "Z" + sb : "X" + sb; string sqc = IsCurrency(_quote) ? "Z" + sq : "X" + sq; if (format == AssetToupleFormat.Names) { return(string.Format("{0}{1}", sb, sq)); } else if (format == AssetToupleFormat.NamesSeparated) { return(string.Format("{0} {1}", sb, sq)); } else if (format == AssetToupleFormat.Descriptions) { return(string.Format("{0}{1}", sbd, sqd)); } else if (format == AssetToupleFormat.DescriptionsSeparated) { return(string.Format("{0} {1}", sbd, sqd)); } else if (format == AssetToupleFormat.CurrencyNames) { return(string.Format("{0}{1}", sbc, sqc)); } else if (format == AssetToupleFormat.CurrencyNamesSeparated) { return(string.Format("{0} {1}", sbc, sqc)); } else { return(null); } }
public static Currency ToCurrency(Asset value) { return(Kraken.ToCurrency(value.GetEnumName()).Value); }