Esempio n. 1
0
        /// <summary>
        /// 从stream中读取数据,并实例化QuoteBasic
        /// </summary>
        /// <param name="stream">stream</param>
        /// <returns></returns>
        public static QuoteBasicBase InitByStream(Stream stream)
        {
            if (stream == null)
            {
                return(null);
            }
            var qb = new QuoteBasicBase("", 1);

            qb.LoadStream(stream, true);
            return(qb);
        }
Esempio n. 2
0
        public QuoteBasicBase Extract(int sindex, int eindex)
        {
            if (sindex < 0 || eindex > this.Count - 1 || eindex < sindex)
            {
                throw new ArgumentException(string.Format("Function {0} sindex: {1}, eindex: {2}, Count: {3}",
                                                          "Extract", sindex, eindex, this.Count));
            }

            int num   = eindex - sindex + 1;
            var quote = new QuoteBasicBase(Symbol, Interval);

            quote.Time.AddRange(Time.GetRange(sindex, num));
            quote.Open.AddRange(Open.GetRange(sindex, num));
            quote.High.AddRange(High.GetRange(sindex, num));
            quote.Low.AddRange(Low.GetRange(sindex, num));
            quote.Close.AddRange(Close.GetRange(sindex, num));
            quote.Volume.AddRange(Volume.GetRange(sindex, num));
            return(quote);
        }