Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 private void UpdateIndex(OrderIndexItem orderIndex)
 {
     database.SaveOrderIndex(orderIndex);
     IndexOrderCache.AddOrUpdate(orderIndex);
 }