private void CreateSingleFill(int size, int totalSize, int cumulativeSize, int remainingSize, double price, TimeStamp time, TimeStamp utcTime, CreateOrChangeOrder 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.BrokerOrder, createSimulatedFills, totalSize, cumulativeSize, remainingSize, false, createActualFills);

            if (debug)
            {
                log.Debug("Enqueuing fill (online: " + isOnline + "): " + fill);
            }
            var wrapper = new FillWrapper
            {
                IsCounterSet = isOnline,
                Fill         = fill,
                Order        = order,
            };

            if (enableSyncTicks && wrapper.IsCounterSet)
            {
                tickSync.AddPhysicalFill(fill);
            }
            fillQueue.Enqueue(wrapper);
        }
Beispiel #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);
            }
        }