Inheritance: IDataSeries
Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
 public static byte GetDataType(DataSeries series) => GetDataTypeFromName(series.Name);
Ejemplo n.º 6
0
 public static string GetSymbol(DataSeries series) => GetSymbol(series.Name);
Ejemplo n.º 7
0
 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);
 }
Ejemplo n.º 8
0
 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;
 }
Ejemplo n.º 9
0
 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);
 }
Ejemplo n.º 10
0
 public override void Delete(string name)
 {
     this.dataFile.Delete(name);
     if (name == this.seriesName)
         this.dataSeries = null;
 }
Ejemplo n.º 11
0
 public DataSeriesEventLogger(DataSeries series)
     : base(Framework.Current, "DataSeriesEventLogger")
 {
     this.series = series;
 }
Ejemplo n.º 12
0
 public DataSeriesEventLogger(Framework framework, DataSeries series)
     : base(framework, "DataSeriesEventLogger")
 {
     this.series = series;
 }
Ejemplo n.º 13
0
 public static byte GetDataType(DataSeries series) => GetDataTypeFromName(series.Name);
Ejemplo n.º 14
0
 public static string GetSymbol(DataSeries series) => GetSymbol(series.Name);
Ejemplo n.º 15
0
 public override object Read(BinaryReader reader, byte version)
 {
     return(DataSeries.FromReader(reader, version));
 }