public void newIndexTick(Index itick) { if (this.InvokeRequired) this.Invoke(new IndexDelegate(newIndexTick), new object[] { itick }); else { if (!itick.isValid) return; for (int i = 0; i < index.Count; i++) if ((client[i] != null) && (index[i].Contains(itick.Name))) WMUtil.SendMsg(itick.Serialize(), TL2.TICKNOTIFY, Handle, client[i]); } }
bool SaveIndex(Index i) { if ((i == null) || (i.Name == null) || (i.Name == "") || !Index.isIdx(i.Name)) return false; if (!filedict.ContainsKey(i.Name)) { try { string fn = _path + @"/" + i.Name + i.Date + ".IDX"; filedict.Add(i.Name, new StreamWriter(fn, true)); } catch (Exception) { return false; } } try { filedict[i.Name].WriteLine(i.Serialize()); } catch (Exception) { return false; } filedict[i.Name].Flush(); return true; }
public void newIndexTick(Index itick) { if (this.InvokeRequired) { this.Invoke(new IndexDelegate(newIndexTick), new object[] { itick }); } else { if (!itick.isValid) { return; } for (int i = 0; i < index.Count; i++) { if ((client[i] != null) && (index[i].Contains(itick.Name))) { WMUtil.SendMsg(itick.Serialize(), TL2.TICKNOTIFY, Handle, client[i]); } } } }
bool SaveIndex(Index i) { if ((i == null) || (i.Name == null) || (i.Name == "") || !Index.isIdx(i.Name)) { return(false); } if (!filedict.ContainsKey(i.Name)) { try { string fn = _path + @"/" + i.Name + i.Date + ".IDX"; filedict.Add(i.Name, new StreamWriter(fn, true)); } catch (Exception) { return(false); } } try { filedict[i.Name].WriteLine(i.Serialize()); } catch (Exception) { return(false); } filedict[i.Name].Flush(); return(true); }
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); }