Ejemplo n.º 1
0
        public FdkRealTimeQuote[] BuildSnapshot()
        {
            if (LastEventData == null)
            {
                return(new FdkRealTimeQuote[0]);
            }
            Quote lastTick   = LastEventData.Tick;
            var   maxBidAsks = Math.Max(lastTick.Bids.Length, lastTick.Asks.Length);
            var   resultList = new List <FdkRealTimeQuote>();

            for (var i = 0; i < maxBidAsks; i++)
            {
                var newItem = new FdkRealTimeQuote()
                {
                    ReceivingTime = LastEventData.ReceivingTime,
                    SendingTime   = LastEventData.SendingTime
                };
                if (i < lastTick.Bids.Length)
                {
                    newItem.BidPrice  = lastTick.Bids[i].Price;
                    newItem.BidVolume = lastTick.Bids[i].Volume;
                }
                if (i < lastTick.Asks.Length)
                {
                    newItem.AskPrice  = lastTick.Asks[i].Price;
                    newItem.AskVolume = lastTick.Asks[i].Volume;
                }
                resultList.Add(newItem);
            }

            return(resultList.ToArray());
        }
Ejemplo n.º 2
0
        public FdkRealTimeQuote[] BuildSnapshot()
        {
			if (LastEventData == null) 
			{
				return new FdkRealTimeQuote[0];
			}
            Quote lastTick = LastEventData.Tick;
            var maxBidAsks = Math.Max(lastTick.Bids.Length, lastTick.Asks.Length);
            var resultList = new List<FdkRealTimeQuote>();
            for (var i = 0; i < maxBidAsks; i++)
            {
                var newItem = new FdkRealTimeQuote()
                {
                    ReceivingTime = LastEventData.ReceivingTime,
                    SendingTime = LastEventData.SendingTime
                };
                if (i < lastTick.Bids.Length)
                {
                    newItem.BidPrice = lastTick.Bids[i].Price;
                    newItem.BidVolume = lastTick.Bids[i].Volume;
                }
                if (i < lastTick.Asks.Length)
                {
                    newItem.AskPrice = lastTick.Asks[i].Price;
                    newItem.AskVolume = lastTick.Asks[i].Volume;
                }
                resultList.Add(newItem);
            }

            return resultList.ToArray();
        }