コード例 #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);
            }
        }
コード例 #2
0
        public IEnumerable <QueryStockResult> QueryStock(out string error)
        {
            TabulateData data;

            if (!QueryData(DataCategory.Stock, out data, out error))
            {
                return(new List <QueryStockResult>());
            }

            return(QueryStockResult.ExtractFrom(data));
        }