Example #1
0
        private Yield SendTickToQueue()
        {
            try {
                SymbolQueue inputQueue = symbolQueues[nextQueue];
                if (!inputQueue.Receive(ref tick))
                {
                    return(Yield.NoWork.Repeat);
                }

                inputQueue.NextTick        = tick;
                inputQueue.NextTick.Symbol = inputQueue.Symbol.BinaryIdentifier;
                return(Yield.DidWork.Invoke(Process));
            } catch (QueueException ex) {
                if (ex.EntryType == EventType.EndHistorical)
                {
                    symbolQueues.RemoveAt(nextQueue);
                    if (symbolQueues.Count <= 0)
                    {
                        if (!receiver.OnEvent(null, (int)EventType.Terminate, null))
                        {
                            throw new ApplicationException("Can't send Terminate.");
                        }
                        Factory.Parallel.CurrentTask.Stop();
                    }
                }
                else
                {
                    throw new ApplicationException("Queue returned invalid entry type: " + ex.EntryType, ex);
                }
            }
            return(Yield.NoWork.Repeat);
        }
Example #2
0
        public void Add(SymbolInfo symbol, Provider provider, TimeStamp lastTime)
        {
            if (debug)
            {
                log.Debug("Add(" + symbol + "," + provider + ")");
            }
            SymbolQueue sq = new SymbolQueue(symbol, provider, lastTime);

            this.symbolQueues.Add(sq);
        }
Example #3
0
 private void ProcessStartup()
 {
     for (int i = 0; i < symbolQueues.Count; i++)
     {
         log.Notice("Initializing Symbol Input Queue for " + symbolQueues[i].Symbol);
         SymbolQueue symbolQueue = symbolQueues[i];
         symbolQueue.Receive(ref tick);
         symbolQueue.NextTick        = tick;
         symbolQueue.NextTick.Symbol = symbolQueue.Symbol.BinaryIdentifier;
         if (debug)
         {
             log.Debug("Initial tick has symbol '" + symbolQueue.NextTick.Symbol + "'");
         }
     }
     if (!receiver.OnEvent(null, (int)EventType.StartRealTime, null))
     {
         throw new ApplicationException("Can't send StartRealTime.");
     }
 }