Пример #1
0
        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);
        }
Пример #2
0
 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);
 }
Пример #3
0
 public static double GetPriceChange(this BinanceOrderBookEntry input, BinanceOrderBookEntry compareto)
 {
     return((input.Price.ChangeType <double>() - compareto.Price.ChangeType <double>()) / compareto.Price.ChangeType <double>() * 100);
 }
Пример #4
0
 public static double GetQuantityChange(this BinanceOrderBookEntry input, BinanceOrderBookEntry compareto)
 {
     return((input.Quantity.ChangeType <double>() - compareto.Quantity.ChangeType <double>()) / compareto.Quantity.ChangeType <double>() * 100);
 }