Example #1
0
        internal BarSlice GetSlice(long barSize)
        {
            BarSlice barSlice = null;

            this.table.TryGetValue(barSize, out barSlice);
            return(barSlice);
        }
Example #2
0
		internal void AddBar(Instrument instrument, Bar bar)
		{
			BarSlice barSlice = null;
			if (!this.table.TryGetValue(bar.Size, out barSlice))
			{
				barSlice = new BarSlice(this.InstrumentsCount);
				this.table.Add(bar.Size, barSlice);
			}
			barSlice.AddBar(instrument, bar);
		}
Example #3
0
        internal void AddBar(Instrument instrument, Bar bar)
        {
            BarSlice barSlice = null;

            if (!this.table.TryGetValue(bar.Size, out barSlice))
            {
                barSlice = new BarSlice(this.InstrumentsCount);
                this.table.Add(bar.Size, barSlice);
            }
            barSlice.AddBar(instrument, bar);
        }
Example #4
0
 public void SetNewBarSlice(long barSize)
 {
     try
     {
         BarSlice slice = this.barSliceManager.GetSlice(barSize);
         if (slice != null)
         {
             foreach (KeyValuePair <FreeQuant.Instruments.Instrument, FreeQuant.Data.Bar> keyValuePair in slice.Table)
             {
                 this.OnNewBar(keyValuePair.Key, keyValuePair.Value);
             }
             slice.Reset();
         }
         foreach (Strategy strategy in this.strategies.Values)
         {
             strategy.OnBarSlice(barSize);
         }
     }
     catch (Exception ex)
     {
         this.EmitError(ex);
     }
 }