public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var result = new SortedSet <ProductOffer>(new ProductOfferComparer(_sortDirection)); foreach (var offer in serializer.Deserialize <List <string[]> >(reader)) { var productOffer = new ProductOffer { Price = decimal.Parse(offer[0], System.Globalization.CultureInfo.InvariantCulture), Size = decimal.Parse(offer[1], System.Globalization.CultureInfo.InvariantCulture) }; Guid orderId; if (Guid.TryParse(offer[2], out orderId)) { productOffer.OrderId = orderId; } result.Add(productOffer); } return(result); }
private void OpenOrder(BookOpen openOrder) { var offer = new ProductOffer { OrderId = openOrder.OrderId, Price = openOrder.Price, Size = openOrder.RemainingSize }; if (openOrder.Side == SideType.Buy) { Buys.Add(offer); } else { Sells.Add(offer); } if (!RemoveReceiveOrder(openOrder.OrderId)) { Api.Log.Warning($"No receive message for order id {openOrder.OrderId}"); } }