public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { JArray arr = JArray.Load(reader); BinanceOrderBookEntry entry = new BinanceOrderBookEntry { Price = (decimal)arr[0], Quantity = (decimal)arr[1] }; return(entry); }
public static OrderBookUpdateType CompareWith(this BinanceOrderBookEntry input, BinanceOrderBookEntry compareto) { if (input.Quantity != compareto.Quantity) { return(OrderBookUpdateType.QuantityChange); } if (input.Price != compareto.Price) { return(OrderBookUpdateType.PriceChange); } return(OrderBookUpdateType.NoChange); }
public static double GetPriceChange(this BinanceOrderBookEntry input, BinanceOrderBookEntry compareto) { return((input.Price.ChangeType <double>() - compareto.Price.ChangeType <double>()) / compareto.Price.ChangeType <double>() * 100); }
public static double GetQuantityChange(this BinanceOrderBookEntry input, BinanceOrderBookEntry compareto) { return((input.Quantity.ChangeType <double>() - compareto.Quantity.ChangeType <double>()) / compareto.Quantity.ChangeType <double>() * 100); }