public void FlushFillQueue()
 {
     if (!isOnline)
     {
         if (verbose)
         {
             log.Verbose("Unable to flush fill queue yet because isOnline is " + isOnline);
         }
         return;
     }
     while (fillQueue.Count > 0)
     {
         var wrapper = fillQueue.Dequeue();
         if (debug)
         {
             log.Debug("Dequeuing fill ( isOnline " + isOnline + "): " + wrapper.Fill);
         }
         if (enableSyncTicks && !wrapper.IsCounterSet)
         {
             tickSync.AddPhysicalFill(wrapper.Fill);
         }
         onPhysicalFill(wrapper.Fill, wrapper.Order);
     }
     while (rejectQueue.Count > 0)
     {
         var wrapper = rejectQueue.Dequeue();
         if (debug)
         {
             log.Debug("Dequeuing reject " + wrapper.Order);
         }
         onRejectOrder(wrapper.Order, wrapper.Message);
     }
 }
Exemplo n.º 2
0
        private void CreateSingleFill(int size, int totalSize, int cumulativeSize, int remainingSize, double price, TimeStamp time, TimeStamp utcTime, PhysicalOrder order)
        {
            if (debug)
            {
                log.Debug("Changing actual position from " + this.actualPosition + " to " + (actualPosition + size) + ". Fill size is " + size);
            }
            this.actualPosition += size;
            if (onPositionChange != null)
            {
                onPositionChange(actualPosition);
            }
            var fill = new PhysicalFillDefault(size, price, time, utcTime, order, createSimulatedFills);

            if (debug)
            {
                log.Debug("Fill: " + fill);
            }
            if (onPhysicalFill == null)
            {
                throw new ApplicationException("Please set the OnPhysicalFill property.");
            }
            else
            {
                if (SyncTicks.Enabled)
                {
                    tickSync.AddPhysicalFill(fill);
                }
                onPhysicalFill(fill, totalSize, cumulativeSize, remainingSize);
            }
        }