public override void GetNextTick(ref MarketDataType gomData) { string lineread; string[] split; gomData.Time = Gom.Utils.nullDT; if (!sr.EndOfStream) { lineread = sr.ReadLine(); if ((lineread != null) && (!firstline)) { split = lineread.Split('\t'); gomData.Time = DateTime.Parse(split[1], _culture); gomData.Price = Double.Parse(split[2], _culture); gomData.Volume = Int32.Parse(split[3]); gomData.TickType = Gom.Utils.GetIntTickType(Double.Parse(split[4], _culture), Double.Parse(split[5], _culture), gomData.Price); } if (firstline) { firstline = false; GetNextTick(ref gomData); } } }
public void SetCursorTime(DateTime time0, ref MarketDataType gomData) { bool found = false; gomData.Time = Gom.Utils.nullDT; long time0tick = time0.Ticks; long ticktime; if (!_inited) { Init(); _inited = true; } found = FindFileNameAndOpen(new DateTime(time0.Year, time0.Month, time0.Day, time0.Hour, 0, 0)); if (found) { do { GetNextTick(ref gomData); ticktime = gomData.Time.Ticks; }while ((ticktime != 0L) && (ticktime < time0tick)); } }
public override void GetNextTick(ref MarketDataType gomData) { string retString = GetNextLinePivotFormatted(); if (retString != null) { string[] split = retString.Split('\t'); gomData.Time = DateTime.ParseExact(split[0], dateformats, CultureInfo.InvariantCulture, DateTimeStyles.None).ToLocalTime(); gomData.TickType = (TickTypeEnum)Enum.Parse(typeof(TickTypeEnum), split[1]); try { gomData.Price = Double.Parse(split[2], curCulture); } catch (FormatException) { SwapCulture(); gomData.Price = Double.Parse(split[2], curCulture); } gomData.Volume = Int32.Parse(split[3]); } else { gomData.Time = Gom.Utils.nullDT; if (ManageFileChange()) GetNextTick(ref gomData); } }
public override void GetNextTick(ref MarketDataType gomData) { string lineread; string[] split; gomData.Time = Gom.Utils.nullDT; if (!sr.EndOfStream) { lineread = sr.ReadLine(); if (lineread != null) { split = lineread.Split(';'); gomData.Time = DateTime.ParseExact(split[0], "yyyyMMdd HHmmss", CultureInfo.InvariantCulture); try { gomData.Price = Double.Parse(split[1], curCulture); } catch (FormatException) { SwapCulture(); gomData.Price = Double.Parse(split[1], curCulture); } gomData.Volume = Int32.Parse(split[2]); gomData.TickType = TickTypeEnum.Unknown; } } }
public override void GetNextTick(ref MarketDataType gomData) { byte statbyte; gomData.IsNewTimeStamp=Gom.MarketDataType.TimeStampStatus.Different; try { statbyte = br.ReadByte(); } catch (EndOfStreamException) { gomData.Time = Gom.Utils.nullDT; if (ManageFileChange()) GetNextTick(ref gomData); return; } if (statbyte >> 6 == 1) { lastReadMinute = DateTime.ParseExact(br.ReadUInt32().ToString("D10") + "00", dateformat, CultureInfo.InvariantCulture).ToLocalTime(); lastReadPivot = br.ReadUInt32() * _tickSize; GetNextTick(ref gomData); return; } else { if (statbyte >> 6 == 3) lastReadSecond = lastReadMinute.AddSeconds(br.ReadByte()); else gomData.IsNewTimeStamp=Gom.MarketDataType.TimeStampStatus.Same; gomData.TickType = (TickTypeEnum)((statbyte & 56 /*00111000*/) >> 3); gomData.Time = lastReadSecond; if ((statbyte & 7 /*00000111*/ ) == 7) { SByte toto = br.ReadSByte(); gomData.Volume = toto & 15 /*00001111*/; gomData.Price = lastReadPivot + ((SByte)(toto & 240 /*11110000*/ ) >> 4) * _tickSize; } else { if ((statbyte & 4 /*00000100*/) > 0) gomData.Price = lastReadPivot + br.ReadInt16() * _tickSize; else gomData.Price = lastReadPivot + br.ReadSByte() * _tickSize; if ((statbyte & 3 /*00000011*/) == 0) gomData.Volume = br.ReadByte(); else if ((statbyte & 3 /*00000011*/) == 1) gomData.Volume = br.ReadUInt16(); else if ((statbyte & 3 /*00000011*/) == 2) gomData.Volume = br.ReadInt32(); } } }
public override void GetNextTick(ref MarketDataType gomData) { string readString = null; string[] split; gomData.Time = Gom.Utils.nullDT; if (!sr.EndOfStream) { readString = sr.ReadLine(); if (readString != null) { split = readString.Split('\t'); if (split.Length == 2) { lastReadMinute = DateTime.ParseExact(split[0] + "00", dateformat, CultureInfo.InvariantCulture).ToLocalTime(); try { lastReadPivot = Double.Parse(split[1], curCulture); } catch (FormatException) { SwapCulture(); lastReadPivot = Double.Parse(split[1], curCulture); } GetNextTick(ref gomData); return; } else if (split.Length == 4) { gomData.Price = Int32.Parse(split[2]) * _tickSize + lastReadPivot; gomData.TickType = (TickTypeEnum)Enum.Parse(typeof(TickTypeEnum), split[1]); gomData.Volume = Int32.Parse(split[3]); lastReadSecond = lastReadMinute.AddSeconds(Int32.Parse(split[0]));; gomData.Time = lastReadSecond; } else if (split.Length == 3) { gomData.Price = Int32.Parse(split[1]) * _tickSize + lastReadPivot; gomData.TickType = (TickTypeEnum)Enum.Parse(typeof(TickTypeEnum), split[0]); gomData.Volume = Int32.Parse(split[2]); gomData.Time = lastReadSecond; } } } else { if (ManageFileChange()) { GetNextTick(ref gomData); } } }
public void SetCursorTime(DateTime time0, ref MarketDataType gomData) { bool found = false; gomData.Time=Gom.Utils.nullDT; long time0tick = time0.Ticks; long ticktime; found = FindFileNameAndOpen(time0.ToUniversalTime().Date); if (found) do { GetNextTick(ref gomData); ticktime = gomData.Time.Ticks; } while ((ticktime != 0L) && (ticktime < time0tick)); }
public override void GetNextTick(ref MarketDataType gomData) { string lineread; string[] split = { "" }; gomData.Time = Gom.Utils.nullDT; if (!sr.EndOfStream) { do { lineread = sr.ReadLine(); if ((lineread != null)) { split = lineread.Split(';'); if (split.Length > 1) { if (!String.IsNullOrEmpty(split[1])) { gomData.Time = DateTime.Parse(split[0], _culture); gomData.Price = Double.Parse(split[1], _culture); gomData.Volume = Int32.Parse(split[2]); gomData.TickType = Gom.Utils.GetIntTickType(bid, ask, gomData.Price); } else { if (!String.IsNullOrEmpty(split[3]) && (split[3] != "0")) { bid = Double.Parse(split[3], _culture); } if (!String.IsNullOrEmpty(split[4]) && (split[4] != "0")) { ask = Double.Parse(split[4], _culture); } //GetNextLineDataFormatted(ref gomData); } } } } while (String.IsNullOrEmpty(split[1]) && (lineread != null)); } }
public override void GetNextTick(ref MarketDataType gomData) { string lineread; string[] split; gomData.Time = Gom.Utils.nullDT; if (!sr.EndOfStream) { lineread = sr.ReadLine(); if (lineread != null) { split = lineread.Split('\t'); gomData.Time = DateTime.Parse(split[0], _culture).Add(TimeSpan.Parse(split[1])); gomData.Price = Double.Parse(split[2], _culture); gomData.Volume = Int32.Parse(split[3]); gomData.TickType = Gom.Utils.GetIntTickType(Double.Parse(split[5], _culture), Double.Parse(split[6], _culture), gomData.Price); } } }
public void SetCursorTime(DateTime time0, ref MarketDataType gomData) { bool found = false; gomData.Time=Gom.Utils.nullDT; long time0tick = time0.Ticks; long ticktime; if (!_inited) { Init(); _inited=true; } found = FindFileNameAndOpen(new DateTime(time0.Year,time0.Month,time0.Day,time0.Hour,0,0)); if (found) do { GetNextTick(ref gomData); ticktime = gomData.Time.Ticks; } while ((ticktime != 0L) && (ticktime < time0tick)); }
//public delegate void GetNextTickDelegate(ref MarketDataType gomData); public void GetNextTick(ref MarketDataType gomData) { if (isRealNinja) { if (newFile) { ReadFirstLine(); gomData.Price=curPrice; gomData.TickType=TickTypeEnum.Unknown; gomData.Volume=(int)firstVolume; gomData.Time=curTime; gomData.IsNewTimeStamp=Gom.MarketDataType.TimeStampStatus.Different; newFile=false; } else { byte statbyte; int i; try { statbyte = br.ReadByte(); } catch (EndOfStreamException) { gomData.Time = Gom.Utils.nullDT; if (ManageFileChange()) GetNextTick(ref gomData); return; } //time int nbbytestimes=statbyte & 3 ; //0000011 if (nbbytestimes != 0) { long nbsec = GetBigEndian[nbbytestimes](); curTime = curTime.AddTicks(nbsec*10000000); if (curTime.Ticks>=_maxtime) { gomData.Time = Gom.Utils.nullDT; if (ManageFileChange()) GetNextTick(ref gomData); return; } gomData.Time=curTime; gomData.IsNewTimeStamp=Gom.MarketDataType.TimeStampStatus.Different; } else { gomData.IsNewTimeStamp=Gom.MarketDataType.TimeStampStatus.Same; } //price int statusprice=(statbyte & 12)>>2;//0001100 int nbbytesprice=0; switch(statusprice) { case 1: //001 nbbytesprice=1; break; case 2: //010 nbbytesprice=2; break; case 3: //011 nbbytesprice=4 ; break; } int deltaprice=GetBigEndian[nbbytesprice](); switch(nbbytesprice) { case 1: deltaprice -= 0x80; break; case 2: deltaprice -= 0x4000; break; case 4: deltaprice -= 0x40000000; break; } curPrice += multiplier*deltaprice; gomData.Price=curPrice; //volume int nbbytesvolume=0; int statusvol=(statbyte & 112)>>4; switch (statusvol) //01110000 { case 1: //001 nbbytesvolume=1; break; case 6: //110 nbbytesvolume=2; break; case 7: //111 nbbytesvolume=4; break; case 2: //010 nbbytesvolume=8; break; case 3: //011 nbbytesvolume=1; break; case 4: //100 nbbytesvolume=1; break; case 5: //101 nbbytesvolume=1; break; } int volume=GetBigEndian[nbbytesvolume](); if (statusvol==3) volume *= 100; else if (statusvol==4) volume *= 500; else if (statusvol==5) volume *= 1000; gomData.Volume=volume; gomData.TickType=TickTypeEnum.Unknown; } } else { try { gomData.Time = new DateTime(br.ReadInt64()); } catch (EndOfStreamException) { gomData.Time = Gom.Utils.nullDT; if (ManageFileChange()) GetNextTick(ref gomData); return; } gomData.Price=br.ReadDouble(); gomData.Volume=br.ReadInt32(); gomData.TickType=TickTypeEnum.Unknown; } }
//public delegate void GetNextTickDelegate(ref MarketDataType gomData); public void GetNextTick(ref MarketDataType gomData) { if (isRealNinja) { if (newFile) { ReadFirstLine(); gomData.Price = curPrice; gomData.TickType = TickTypeEnum.Unknown; gomData.Volume = (int)firstVolume; gomData.Time = curTime; gomData.IsNewTimeStamp = Gom.MarketDataType.TimeStampStatus.Different; newFile = false; } else { byte statbyte; int i; try { statbyte = br.ReadByte(); } catch (EndOfStreamException) { gomData.Time = Gom.Utils.nullDT; if (ManageFileChange()) { GetNextTick(ref gomData); } return; } //time int nbbytestimes = statbyte & 3; //0000011 if (nbbytestimes != 0) { long nbsec = GetBigEndian[nbbytestimes](); curTime = curTime.AddTicks(nbsec * 10000000); if (curTime.Ticks >= _maxtime) { gomData.Time = Gom.Utils.nullDT; if (ManageFileChange()) { GetNextTick(ref gomData); } return; } gomData.Time = curTime; gomData.IsNewTimeStamp = Gom.MarketDataType.TimeStampStatus.Different; } else { gomData.IsNewTimeStamp = Gom.MarketDataType.TimeStampStatus.Same; } //price int statusprice = (statbyte & 12) >> 2; //0001100 int nbbytesprice = 0; switch (statusprice) { case 1: //001 nbbytesprice = 1; break; case 2: //010 nbbytesprice = 2; break; case 3: //011 nbbytesprice = 4; break; } int deltaprice = GetBigEndian[nbbytesprice](); switch (nbbytesprice) { case 1: deltaprice -= 0x80; break; case 2: deltaprice -= 0x4000; break; case 4: deltaprice -= 0x40000000; break; } curPrice += multiplier * deltaprice; gomData.Price = curPrice; //volume int nbbytesvolume = 0; int statusvol = (statbyte & 112) >> 4; switch (statusvol) //01110000 { case 1: //001 nbbytesvolume = 1; break; case 6: //110 nbbytesvolume = 2; break; case 7: //111 nbbytesvolume = 4; break; case 2: //010 nbbytesvolume = 8; break; case 3: //011 nbbytesvolume = 1; break; case 4: //100 nbbytesvolume = 1; break; case 5: //101 nbbytesvolume = 1; break; } int volume = GetBigEndian[nbbytesvolume](); if (statusvol == 3) { volume *= 100; } else if (statusvol == 4) { volume *= 500; } else if (statusvol == 5) { volume *= 1000; } gomData.Volume = volume; gomData.TickType = TickTypeEnum.Unknown; } } else { try { gomData.Time = new DateTime(br.ReadInt64()); } catch (EndOfStreamException) { gomData.Time = Gom.Utils.nullDT; if (ManageFileChange()) { GetNextTick(ref gomData); } return; } gomData.Price = br.ReadDouble(); gomData.Volume = br.ReadInt32(); gomData.TickType = TickTypeEnum.Unknown; } }
public override void GetNextTick(ref MarketDataType gomData) { string readString = null; string[] split; gomData.Time = Gom.Utils.nullDT; if (!sr.EndOfStream) { readString = sr.ReadLine(); if (readString != null) { split = readString.Split('\t'); if (split.Length == 2) { lastReadMinute = DateTime.ParseExact(split[0] + "00", dateformat, CultureInfo.InvariantCulture).ToLocalTime(); try { lastReadPivot = Double.Parse(split[1], curCulture); } catch (FormatException) { SwapCulture(); lastReadPivot = Double.Parse(split[1], curCulture); } GetNextTick(ref gomData); return; } else if (split.Length == 4) { gomData.Price = Int32.Parse(split[2]) * _tickSize + lastReadPivot; gomData.TickType = (TickTypeEnum)Enum.Parse(typeof(TickTypeEnum), split[1]); gomData.Volume = Int32.Parse(split[3]); lastReadSecond = lastReadMinute.AddSeconds(Int32.Parse(split[0])); ; gomData.Time = lastReadSecond; } else if (split.Length == 3) { gomData.Price = Int32.Parse(split[1]) * _tickSize + lastReadPivot; gomData.TickType = (TickTypeEnum)Enum.Parse(typeof(TickTypeEnum), split[0]); gomData.Volume = Int32.Parse(split[2]); gomData.Time = lastReadSecond; } } } else { if (ManageFileChange()) GetNextTick(ref gomData); } }
public abstract void GetNextTick(ref MarketDataType gomData);
public override void GetNextTick(ref MarketDataType gomData) { string lineread; string[] split = { "" }; gomData.Time = Gom.Utils.nullDT; if (!sr.EndOfStream) do { lineread = sr.ReadLine(); if ((lineread != null)) { split = lineread.Split(';'); if (split.Length > 1) { if (!String.IsNullOrEmpty(split[1])) { gomData.Time = DateTime.Parse(split[0], _culture); gomData.Price = Double.Parse(split[1], _culture); gomData.Volume = Int32.Parse(split[2]); gomData.TickType = Gom.Utils.GetIntTickType(bid, ask, gomData.Price); } else { if (!String.IsNullOrEmpty(split[3]) && (split[3] != "0")) bid = Double.Parse(split[3], _culture); if (!String.IsNullOrEmpty(split[4]) && (split[4] != "0")) ask = Double.Parse(split[4], _culture); //GetNextLineDataFormatted(ref gomData); } } } } while (String.IsNullOrEmpty(split[1]) && (lineread != null)); }