예제 #1
0
        public void DeleteSingleTransaction(string transactionId)
        {
            var item = Get(transactionId);

            database.DeleteOrderIndex(transactionId);
            IndexOrderCache.Remove(transactionId);

            database.UpdateToKeyMap("orders_" + item.TradingPair, transactionId);
        }
예제 #2
0
        public OrderIndexItem Get(string transactionId)
        {
            var cachedIndex = IndexOrderCache.Get(transactionId);

            if (cachedIndex != null)
            {
                return(cachedIndex);
            }

            var index = database.GetOrderIndex(transactionId);

            if (index != null)
            {
                IndexOrderCache.AddOrUpdate(index);
            }
            return(index);
        }
예제 #3
0
        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);
        }
예제 #4
0
 public void DeleteIndex(TransactionOrderLimit record)
 {
     database.DeleteOrderIndex(record.TransactionId);
     database.DeleteKeyMap("orders_" + record.TradingPair);
     IndexOrderCache.Remove(record.TransactionId);
 }
예제 #5
0
 private void UpdateIndex(OrderIndexItem orderIndex)
 {
     database.SaveOrderIndex(orderIndex);
     IndexOrderCache.AddOrUpdate(orderIndex);
 }