Example #1
0
        public bool getTick()
        {
            string line = "";

            try
            {
                line = this.cf.ReadLine();
            }
            catch (Exception ex) { show(ex.Message + Environment.NewLine); }
            tick        = new eSigTick();
            tick.factor = factorsize;
            bool good = false;

            try
            {
                good = tick.Load(line);
            }
            catch (AlreadySmallSizeException)
            {
                factorsize  = 1; // fix it for this file
                tick.factor = factorsize;
                good        = tick.Load(line);
            }
            tick.sym = symbol;
            return(good);
        }
Example #2
0
        bool getTick()
        {
            string line = "";

            t = new eSigTick();
            try
            {
                line = this.inf.ReadLine();
            }
            catch (Exception ex) { show(ex.Message); }
            return(t.Load(line));
        }
Example #3
0
        void Convert(string file)
        {
            StreamReader epf    = new StreamReader(file);
            Stock        s      = eSigTick.InitEpf(epf);
            string       symbol = s.Symbol.Replace("//", "");

            if (symmap.ContainsKey(symbol))
            {
                symbol = symbol.Replace(symbol, symmap[symbol]);
            }
            string filename = symbol + s.Date + ".IDX";

            d("Attempting to convert: " + file + " -> " + filename);
            StreamWriter idx;

            try
            {
                idx = new StreamWriter(filename, false);
            }
            catch (Exception ex) { d(ex.Message); return; }

            decimal o = 0;
            decimal h = 0;
            decimal l = 100000000000;

            while (!epf.EndOfStream)
            {
                eSigTick et = new eSigTick();
                et.sym = prefix + symbol;
                try
                {
                    string line = epf.ReadLine();                      // get our tick from EPF
                    et.Load(line);
                    if (et.FullQuote)
                    {
                        continue;
                    }
                }
                catch (Exception ex) { d(ex.Message); continue; }

                // set o/h/l/c
                decimal v = et.trade;
                if (o == 0)
                {
                    o = v;
                }
                if (v > h)
                {
                    h = v;
                }
                if (v < l)
                {
                    l = v;
                }
                Index i = new Index(et.sym, v, o, h, l, v, et.date, et.time); // map to our index
                idx.WriteLine(i.Serialize());                                 // write our index
            }
            idx.Close();
            epf.Close();
            d("Finished converting " + filename);
        }