Пример #1
0
        public void ReadAndOverwrite()
        {
            const string tf = @"SPX20070926.TIK";

            // read a barlist
            var bl = BarListImpl.FromTIK(tf);

            // get new bars
            var newbl = BarListImpl.DayFromGoogle("FTI");

            // append
            for (int i = 0; i < newbl.Count; i++)
            {
                foreach (var k in BarImpl.ToTick(newbl[i]))
                {
                    bl.newTick(k);
                }
            }



            // write the barlist
            Assert
            .IsTrue(BarListImpl.ChartSave(bl, Environment.CurrentDirectory, 20070926), "error saving new data");
        }
Пример #2
0
        /// <summary>
        /// create ticks from bars on default interval
        /// </summary>
        /// <param name="bl"></param>
        /// <returns></returns>
        public static Tick[] Barlist2Tick(BarList bl)
        {
            List <Tick> k = new List <Tick>(bl.Count * 4);

            foreach (Bar b in bl)
            {
                k.AddRange(BarImpl.ToTick(b));
            }
            return(k.ToArray());
        }
Пример #3
0
        Tick[] ConvertLine(List <string> line)
        {
            if (type == ConvertMapType.Bar)
            {
                var b = GetBar(line);
                if (ignoreinvalidtick && !b.isValid)
                {
                    return(new Tick[0]);
                }
                return(BarImpl.ToTick(b));
            }
            var k = GetTick(line);

            if (ignoreinvalidtick && !k.isValid)
            {
                return(new Tick[0]);
            }
            return(new Tick[] { k });
        }