Exemplo n.º 1
0
        public static IEnumerable <QueryGeneralOrderResult> ExtractFrom(TabulateData data)
        {
            if (columnIndices == null)
            {
                columnIndices = columns.Select(c => data.GetColumnIndex(c)).ToArray();
            }

            var subData = data.GetSubColumns(columnIndices);

            foreach (var row in subData.Rows)
            {
                QueryGeneralOrderResult result = new QueryGeneralOrderResult();

                int index = 0;
                result.OrderNo        = int.Parse(row[index++]);
                result.SubmissionTime = row[index++];
                result.SecurityCode   = row[index++];
                result.SecurityName   = row[index++];
                result.BuySellFlag    = row[index++];
                result.StatusString   = row[index++];
                result.Status         = TradingHelper.ConvertStringToOrderStatus(result.StatusString);

                result.SubmissionPrice  = TradingHelper.SafeParseFloat(row[index++]);
                result.SubmissionVolume = TradingHelper.SafeParseInt(row[index++]);
                result.DealPrice        = TradingHelper.SafeParseFloat(row[index++]);
                result.DealVolume       = TradingHelper.SafeParseInt(row[index++]);
                result.SubmissionType   = row[index++];
                result.PricingType      = row[index++];

                yield return(result);
            }
        }
Exemplo n.º 2
0
        public static IEnumerable <FiveLevelQuote> ExtractFrom(TabulateData data, DateTime timestamp)
        {
            if (columnIndices == null)
            {
                columnIndices = columns.Select(c => data.GetColumnIndex(c)).ToArray();
            }

            var subData = data.GetSubColumns(columnIndices);

            foreach (var row in subData.Rows)
            {
                FiveLevelQuote quote = new FiveLevelQuote(timestamp);

                int index = 0;
                quote.SecurityCode        = row[index++];
                quote.SecurityName        = row[index++];
                quote.YesterdayClosePrice = TradingHelper.SafeParseFloat(row[index++]);
                quote.TodayOpenPrice      = TradingHelper.SafeParseFloat(row[index++]);
                quote.CurrentPrice        = TradingHelper.SafeParseFloat(row[index++]);
                quote.BuyPrices           = new float[5];
                quote.BuyVolumesInHand    = new int[5];
                quote.SellPrices          = new float[5];
                quote.SellVolumesInHand   = new int[5];

                quote.BuyPrices[0] = TradingHelper.SafeParseFloat(row[index++]);
                quote.BuyPrices[1] = TradingHelper.SafeParseFloat(row[index++]);
                quote.BuyPrices[2] = TradingHelper.SafeParseFloat(row[index++]);
                quote.BuyPrices[3] = TradingHelper.SafeParseFloat(row[index++]);
                quote.BuyPrices[4] = TradingHelper.SafeParseFloat(row[index++]);

                quote.BuyVolumesInHand[0] = TradingHelper.SafeParseInt(row[index++]);
                quote.BuyVolumesInHand[1] = TradingHelper.SafeParseInt(row[index++]);
                quote.BuyVolumesInHand[2] = TradingHelper.SafeParseInt(row[index++]);
                quote.BuyVolumesInHand[3] = TradingHelper.SafeParseInt(row[index++]);
                quote.BuyVolumesInHand[4] = TradingHelper.SafeParseInt(row[index++]);

                quote.SellPrices[0] = TradingHelper.SafeParseFloat(row[index++]);
                quote.SellPrices[1] = TradingHelper.SafeParseFloat(row[index++]);
                quote.SellPrices[2] = TradingHelper.SafeParseFloat(row[index++]);
                quote.SellPrices[3] = TradingHelper.SafeParseFloat(row[index++]);
                quote.SellPrices[4] = TradingHelper.SafeParseFloat(row[index++]);

                quote.SellVolumesInHand[0] = TradingHelper.SafeParseInt(row[index++]);
                quote.SellVolumesInHand[1] = TradingHelper.SafeParseInt(row[index++]);
                quote.SellVolumesInHand[2] = TradingHelper.SafeParseInt(row[index++]);
                quote.SellVolumesInHand[3] = TradingHelper.SafeParseInt(row[index++]);
                quote.SellVolumesInHand[4] = TradingHelper.SafeParseInt(row[index++]);

                yield return(quote);
            }
        }