public void UpdateIndexForMatchedOrder(TransactionOrderMatch record) { if (record.PartialOrFull == TradePartialFull.Full) { DeleteSingleTransaction(record.OrderTransactionId); } else if (record.PartialOrFull == TradePartialFull.Partial) { var orderIndex = new OrderIndexItem() { TransactionId = record.OrderTransactionId, Owner = record.OrderAddress, TradingPair = record.TradingPair, Side = record.Side, Amount = record.Amount, Price = record.Price }; UpdateIndex(orderIndex); } }
public void AddToIndex(TransactionOrderLimit record) { if (record == null) { return; } var orderIndex = new OrderIndexItem() { TransactionId = record.TransactionId, Owner = record.Owner, TradingPair = record.TradingPair, Side = record.Side, Amount = record.Amount, Price = record.Price }; database.SaveOrderIndex(orderIndex); IndexOrderCache.AddOrUpdate(orderIndex); database.AddToKeyMap("orders_" + record.TradingPair, record.TransactionId); database.AddToKeyMap("orders_expiry_" + record.ExpiryBlockIndex, record.TransactionId); }
public static void AddOrUpdate(OrderIndexItem item) { if (cache == null) { cache = new List <OrderIndexItem>(); cache.Add(item); } else { var find = cache.Where(x => x.TransactionId == item.TransactionId) .FirstOrDefault(); if (find == null) { cache.Add(item); } else { cache.Remove(find); cache.Add(item); } } }
private void UpdateIndex(OrderIndexItem orderIndex) { database.SaveOrderIndex(orderIndex); IndexOrderCache.AddOrUpdate(orderIndex); }