Example #1
0
        public static IEnumerable <QueryStockResult> 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)
            {
                QueryStockResult result = new QueryStockResult();

                int index = 0;

                result.SecurityCode      = row[index++];
                result.SecurityName      = row[index++];
                result.Volume            = TradingHelper.SafeParseFloat(row[index++]);
                result.SellableVolume    = TradingHelper.SafeParseFloat(row[index++]);
                result.ReferenceCost     = TradingHelper.SafeParseFloat(row[index++]);
                result.CurrentPrice      = TradingHelper.SafeParseFloat(row[index++]);
                result.LatestMarketValue = TradingHelper.SafeParseFloat(row[index++]);
                result.ProfitPercentage  = TradingHelper.SafeParseFloat(row[index++]);

                yield return(result);
            }
        }
Example #2
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);
            }
        }
Example #3
0
        public static IEnumerable <QueryShareholderRegistryResult> 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)
            {
                QueryShareholderRegistryResult result = new QueryShareholderRegistryResult();

                int index = 0;
                result.ShareholderCode = row[index++];
                result.Exchange        = row[index] == "0" ? Exchange.ShenzhenExchange : (row[index] == "1" ? Exchange.ShanghaiExchange : null);
                index++;

                result.CapitalAccount = row[index++];
                result.SeatCode       = row[index++];;
                result.Notes          = row[index++];

                yield return(result);
            }
        }
        public static IEnumerable <QuerySucceededOrderResult> 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)
            {
                QuerySucceededOrderResult result = new QuerySucceededOrderResult();

                int index = 0;
                result.OrderNo      = int.Parse(row[index++]);
                result.DealNo       = int.Parse(row[index++]);
                result.DealTime     = row[index++];
                result.SecurityCode = row[index++];
                result.SecurityName = row[index++];
                result.BuySellFlag  = row[index++];
                result.DealPrice    = TradingHelper.SafeParseFloat(row[index++]);
                result.DealVolume   = TradingHelper.SafeParseFloat(row[index++]);
                result.DealAmount   = TradingHelper.SafeParseFloat(row[index++]);

                yield return(result);
            }
        }
        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);
            }
        }
Example #6
0
        public static IEnumerable <SendOrderResult> 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)
            {
                SendOrderResult result = new SendOrderResult();

                int index = 0;
                result.OrderNo          = int.Parse(row[index++]);
                result.ReturnedInfo     = row[index++];
                result.CheckingRiskFlag = row[index++];
                result.ReservedInfo     = row[index++];

                yield return(result);
            }
        }
        public static IEnumerable <QueryCapitalResult> 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)
            {
                QueryCapitalResult result = new QueryCapitalResult();

                int index = 0;
                result.RemainingCapital  = TradingHelper.SafeParseFloat(row[index++]);
                result.UsableCapital     = TradingHelper.SafeParseFloat(row[index++]);
                result.FrozenCapital     = TradingHelper.SafeParseFloat(row[index++]);
                result.CashableCapital   = TradingHelper.SafeParseFloat(row[index++]);
                result.TotalEquity       = TradingHelper.SafeParseFloat(row[index++]);
                result.LatestMarketValue = TradingHelper.SafeParseFloat(row[index++]);

                yield return(result);
            }
        }