public static bool TryGetBarTypeSize(DataSeries series, out BarType barType, out long barSize) { barType = BarType.Time; barSize = 0; var parts = series.Name.Split(new[] { '.' }, StringSplitOptions.None); return parts.Length >= 3 && GetDataType(series) == DataObjectType.Bar && Enum.TryParse<BarType>(parts[parts.Length - 3], out barType) && long.TryParse(parts[parts.Length - 2], out barSize); }
public DataSeries GetSeries(string fileName, string seriesName) { var file = GetFile(fileName, FileMode.OpenOrCreate); var series = (DataSeries)file.Get(seriesName); if (series == null) { series = new DataSeries(seriesName); file.Write(seriesName, series); } return series; }
public override int Get(string seriesName) { if (this.idByName.ContainsKey(seriesName)) return this.idByName[seriesName]; var dataSeries = (DataSeries)this.dataFile.Get(seriesName); if (dataSeries == null) { dataSeries = Host == null ? new DataSeries(seriesName) : new NetDataSeries(seriesName); this.dataFile.Write(seriesName, dataSeries); } int num = this.count++; this.idByName[seriesName] = num; this.nameById[num] = seriesName; this.serieses[num] = dataSeries; return num; }
private DataSeriesObject CreateDataSeriesEmitter(DataSeries series, DateTime dateTime1, DateTime dateTime2) { var q = new EventQueue(EventQueueId.Data, EventQueueType.Master, EventQueuePriority.Normal, 25600, null) { IsSynched = true, Name = series.Name }; q.Enqueue(new OnQueueOpened(q)); this.framework.EventBus.DataPipe.Add(q); return new DataSeriesObject(series, dateTime1, dateTime2, q, Processor); }
public static byte GetDataType(DataSeries series) => GetDataTypeFromName(series.Name);
public static string GetSymbol(DataSeries series) => GetSymbol(series.Name);
public static Instrument GetInstrument(DataSeries series, Framework framework) { var parts = series.Name.Split(new[] { '.' }, StringSplitOptions.None); var id = GetDataType(series) == DataObjectType.Bar ? int.Parse(parts[parts.Length - 4]) : int.Parse(parts[parts.Length - 2]); return framework.InstrumentManager.GetById(id); }
public DataSeriesIterator(DataSeries series, long index1 = -1, long index2 = -1) { this.series = series; this.index1 = index1 != -1 ? index1 : 0; this.index2 = index2 != -1 ? series.Count - 1 : 0; this.current = index1; }
public override void Save(ExecutionMessage message, int id = -1) { DataSeries series; if (id == -1) { if (this.dataSeries == null) { int id2 = Get(this.seriesName); this.dataSeries = this.serieses[id2]; series = this.dataSeries; } else { series = this.dataSeries; } } else { series = this.serieses[id]; if (series == null) { Console.WriteLine($"FileOrderServer::Save Error. Series with id does not exist : {id}"); return; } } series.Add(message); }
public override void Delete(string name) { this.dataFile.Delete(name); if (name == this.seriesName) this.dataSeries = null; }
public DataSeriesEventLogger(DataSeries series) : base(Framework.Current, "DataSeriesEventLogger") { this.series = series; }
public DataSeriesEventLogger(Framework framework, DataSeries series) : base(framework, "DataSeriesEventLogger") { this.series = series; }
public override object Read(BinaryReader reader, byte version) { return(DataSeries.FromReader(reader, version)); }