コード例 #1
0
        public ExchangeOrder WithUpdatedRemainingVolume(decimal lastTradeAmount)
        {
            var remainingVolume = this.RemainingVolume - lastTradeAmount;

            ExchangeOrderStatus newStatus = this.Status;

            if (remainingVolume == 0)
            {
                newStatus = ExchangeOrderStatus.Closed;
            }

            //this is important. When we want to update an item in bids or asks, we remove it, change its remaining volume by calling this method, and add it back into the sorted set.
            //If the timestamp were to change, the order might loose it's spot in the queue.
            var utcTimestamp = this.UTCTimestamp;

            var order = new ExchangeOrder(
                this.ID,
                this.ExchangeID,
                this.OSide,
                this.OType,
                this.Price,
                this.Size,
                remainingVolume,
                newStatus,
                utcTimestamp);

            return(order);
        }
コード例 #2
0
 public ExchangeOrder(int id, int exchangeID, OrderSide oSide, OrderType oType, decimal price, decimal size, decimal remainingVolume, ExchangeOrderStatus status, DateTimeOffset utcTimestamp)
 {
     ID              = id;
     ExchangeID      = exchangeID;
     OSide           = oSide;
     OType           = oType;
     Price           = price;
     Size            = size;
     RemainingVolume = remainingVolume;
     Status          = status;
     UTCTimestamp    = utcTimestamp;
 }
コード例 #3
0
        public ExchangeOrder WithUpdatedStatus(ExchangeOrderStatus newStatus)
        {
            var order = new ExchangeOrder(
                this.ID,
                this.ExchangeID,
                this.OSide,
                this.OType,
                this.Price,
                this.Size,
                this.RemainingVolume,
                newStatus,
                this.UTCTimestamp);

            return(order);
        }