Example #1
0
 /// <summary>
 /// Loads a tick straight from an EPF file in the form of a StreamReader
 /// </summary>
 /// <param name="symbol">The symbol.</param>
 /// <param name="sr">The sr.</param>
 /// <returns></returns>
 public static eSigTick FromStream(string symbol, System.IO.StreamReader sr)
 {
     eSigTick e = new eSigTick();
     e.Load(sr.ReadLine());
     e.sym = symbol;
     return e;
 }
Example #2
0
        /// <summary>
        /// Loads a tick straight from an EPF file in the form of a StreamReader
        /// </summary>
        /// <param name="symbol">The symbol.</param>
        /// <param name="sr">The sr.</param>
        /// <returns></returns>
        public static eSigTick FromStream(string symbol, System.IO.StreamReader sr)
        {
            eSigTick e = new eSigTick();

            e.Load(sr.ReadLine());
            e.sym = symbol;
            return(e);
        }
Example #3
0
 bool getTick()
 {
     string line = "";
     t = new eSigTick();
     try
     {
         line = this.inf.ReadLine();
     }
     catch (Exception ex) { show(ex.Message); }
     return t.Load(line);
 }
Example #4
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);
		}
Example #5
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;
 }