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

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

            database.UpdateToKeyMap("orders_" + item.TradingPair, transactionId);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #4
0
 public void DeleteIndex(TransactionOrderLimit record)
 {
     database.DeleteOrderIndex(record.TransactionId);
     database.DeleteKeyMap("orders_" + record.TradingPair);
     IndexOrderCache.Remove(record.TransactionId);
 }
Beispiel #5
0
 private void UpdateIndex(OrderIndexItem orderIndex)
 {
     database.SaveOrderIndex(orderIndex);
     IndexOrderCache.AddOrUpdate(orderIndex);
 }