Пример #1
0
 private void TryCompleteTick()
 {
     if (tickSync.Completed)
     {
         if (trace)
         {
             log.Trace("TryCompleteTick()");
         }
         tickSync.Clear();
     }
     else if (tickSync.OnlyProcessPhysicalOrders)
     {
         fillSimulator.StartTick(nextTick);
         fillSimulator.ProcessOrders();
         tickSync.RemoveProcessPhysicalOrders();
     }
 }
Пример #2
0
 private void TryCompleteTick()
 {
     if (endOfTickData)
     {
         if (tickSync.SentSwtichBrokerState)
         {
             tickSync.ClearSwitchBrokerState("Finished.");
         }
         if (tickSync.SentOrderChange)
         {
             tickSync.RemoveOrderChange();
         }
     }
     if (!endOfTickData && tickSync.Completed)
     {
         if (verbose)
         {
             log.Verbose("TryCompleteTick() Next Tick");
         }
         tickSync.Clear();
     }
     else if (tickSync.OnlyProcessPhysicalOrders)
     {
         if (trace)
         {
             log.Trace("Process physical orders - " + tickSync);
         }
         FillSimulator.StartTick(nextTick);
         if (FillSimulator.IsChanged)
         {
             FillSimulator.ProcessOrders();
         }
         tickSync.RemoveProcessPhysicalOrders();
     }
     else if (tickSync.OnlyReprocessPhysicalOrders || FillSimulator.IsChanged)
     {
         if (trace)
         {
             log.Trace("Reprocess physical orders - " + tickSync);
         }
         if (FillSimulator.IsChanged)
         {
             FillSimulator.ProcessOrders();
         }
         if (tickSync.SentReprocessPhysicalOrders)
         {
             tickSync.ClearReprocessPhysicalOrders();
         }
     }
 }
        private bool DequeueTick()
        {
            LatencyManager.IncrementSymbolHandler();
            var result = false;

            if (tickPool.AllocatedCount >= tickPool.Capacity / 2)
            {
                return(false);
            }
            while (!quoteSimulatorSupport.QuotePacketQueue.IsFull)
            {
                if (!reader.TryReadTick(temporaryTick))
                {
                    if (onEndTick != null)
                    {
                        onEndTick(id);
                    }
                    else
                    {
                        throw new ApplicationException("OnEndTick was null");
                    }
                    queueTask.Stop();
                    return(result);
                }
                tickCounter++;
                if (isFirstTick)
                {
                    currentTick.Inject(temporaryTick.Extract());
                }
                else
                {
                    currentTick.Inject(nextTick.Extract());
                }
                isFirstTick = false;
                FillSimulator.StartTick(currentTick);
                nextTick.Inject(temporaryTick.Extract());
                if (FillSimulator.IsChanged)
                {
                    FillSimulator.ProcessOrders();
                }
                if (trace)
                {
                    log.Trace("Dequeue tick " + nextTick.UtcTime + "." + nextTick.UtcTime.Microsecond);
                }
                ProcessOnTickCallBack();
                result = true;
            }
            return(result);
        }
 private Yield SendPlayBackTick()
 {
     LatencyManager.IncrementSymbolHandler();
     latency.TryUpdate(nextTick.lSymbol, nextTick.UtcTime.Internal);
     if (isFirstTick)
     {
         FillSimulator.StartTick(nextTick);
         isFirstTick = false;
     }
     else
     {
         if (FillSimulator.IsChanged)
         {
             FillSimulator.ProcessOrders();
         }
     }
     return(Yield.DidWork.Invoke(ProcessOnTickCallBack));
 }