public void FlushFillQueues()
        {
            var handlers = new List <SimulateSymbol>();

            using (symbolHandlersLocker.Using())
            {
                if (debug)
                {
                    log.Debug("Flushing all fill queues.");
                }
                foreach (var kvp in symbolHandlers)
                {
                    handlers.Add(kvp.Value);
                }
            }
            foreach (var handler in handlers)
            {
                handler.FillSimulator.FlushFillQueue();
            }
            if (debug)
            {
                log.Debug("Current FIX Simulator orders.");
            }
            foreach (var handler in handlers)
            {
                handler.FillSimulator.LogActiveOrders();
            }
        }
        private unsafe void BookRebuild(LimeQuoteMessage message)
        {
            //UNDONE: Use the symbol_len field from the message and the action to filter
            LimeQuotesInterop.book_rebuild_msg *bookMsg = (LimeQuotesInterop.book_rebuild_msg *)message.Ptr;
            int last = 0;

            for (int i = 0; i < LimeQuotesInterop.SYMBOL_LEN; i++)
            {
                if (bookMsg->symbol[i] == 0)
                {
                    last = i;
                    break;
                }
            }
            string symbol = new string((sbyte *)bookMsg->symbol, 0, last);

            log.InfoFormat("Book Rebuild for {0} id {1} flags {2}", symbol, bookMsg->symbol_index, bookMsg->symbol_flags);

            using (_SymbolIDLock.Using())
            {
                uint id = Reverse(bookMsg->symbol_index);
                if (!_SymbolID.ContainsKey(symbol))
                {
                    _SymbolID.Add(symbol, id);
                    _IDToSymbol.Add(id, symbol);
                    _IDToBookRebuild.Add(id, (bookMsg->symbol_flags & 1) == 0);
                }
                else
                {
                    _SymbolID[symbol]    = id;
                    _IDToSymbol[id]      = symbol;
                    _IDToBookRebuild[id] = (bookMsg->symbol_flags & 1) == 0;
                }
            }
        }
 public string SymbolPositionsToString()
 {
     using (positionsLocker.Using())
     {
         return(SymbolPositionsToStringInternal());
     }
 }
Exemple #4
0
 public ActiveListNode <T> Create(T item)
 {
     using (_sync.Using()) {
         if (_nodes.Count == 0)
         {
             Interlocked.Increment(ref count);
             return(new ActiveListNode <T>(item));
         }
         else
         {
             var node = _nodes.Pop();
             node.Value = item;
             return(node);
         }
     }
 }
Exemple #5
0
 public virtual void Start(EventItem eventItem)
 {
     using (startLocker.Using())
     {
         if (!isTaskPrepared)
         {
             throw new ApplicationException("Read must be Initialized before Start() can be called and after GetLastTick() the reader must be disposed.");
         }
         if (!isStarted)
         {
             this.agent = eventItem.Agent;
             var symbol = tickFile.Symbol;
             if (debug)
             {
                 log.Debug("Start called.");
             }
             start          = Factory.TickCount;
             diagnoseMetric = Diagnose.RegisterMetric("Reader." + symbol.Symbol.StripInvalidPathChars());
             var tempQueue        = Factory.Parallel.FastQueue <int>(symbol + " Reader Nominal Queue");
             var tempConnectionId = 0;
             fileReaderTask.ConnectInbound(tempQueue, out tempConnectionId);
             fileReaderTask.IncreaseInbound(tempConnectionId, 0L);
             isStarted = true;
         }
     }
 }