Beispiel #1
0
 private static void EmitNewBarOpen(object sender, BarEventArgs e)
 {
     if (ProviderManager.threadSafe)
     {
         Monitor.Enter(ProviderManager.dataLock);
     }
     try
     {
         if (ProviderManager.NewBarOpen != null)
         {
             ProviderManager.NewBarOpen(sender, e);
         }
     }
     finally
     {
         if (ProviderManager.threadSafe)
         {
             Monitor.Exit(ProviderManager.dataLock);
         }
     }
 }
Beispiel #2
0
 private void OnNewBar(object sender, BarEventArgs args)
 {
   if (!this.isRunning || !this.cbxBars.Checked)
     return;
   this.queue.Enqueue((Action) (() =>
   {
     Instrument local_0 = ((IntradayEventArgs) args).Instrument as Instrument;
     InstrumentRow local_1 = this.instruments[local_0] as InstrumentRow;
     if (local_1 == null)
       return;
     local_0.Add(args.Bar);
     ++local_1.Bars;
   }));
 }
Beispiel #3
0
 private static void OnNewBarOpen(object sender, BarEventArgs e)
 {
     if (Trace.IsLevelEnabled(TraceLevel.Verbose))
         Trace.WriteLine("(Open)Bar {0}" + e);
     Instrument instrument = e.Instrument as Instrument ?? InstrumentManager.Instruments[e.Instrument.Symbol, e.Provider.Name];
     if (instrument != null)
           instrument.EmitNewBarOpen(e);
 }
Beispiel #4
0
 private static void OnNewBar(object sender, BarEventArgs e)
 {
     if (Trace.IsLevelEnabled(TraceLevel.Verbose))
         Trace.WriteLine("Bar {0}" + e);
     Instrument instrument = e.Instrument as Instrument ?? InstrumentManager.Instruments[e.Instrument.Symbol, e.Provider.Name];
     if (instrument == null)
         return;
     DataManager.barSeriesList.Add(instrument, e.Bar);
     BarSeries barSeries = DataManager.barSeriesList[instrument, e.Bar.BarType, e.Bar.Size];
     // TODO:HEHEHHE
     if (DataManager.barArrayLength != -1 && barSeries.Count > DataManager.barArrayLength)
         ((TimeSeries)barSeries).Remove(0);
     instrument.EmitNewBar(e);
 }
Beispiel #5
0
		internal void o5eWrOl4Ph(BarEventArgs obj0)
		{
			try
			{
				Instrument instrument = obj0.Instrument as Instrument;
				Bar bar = obj0.Bar;
				foreach (StrategyBase strategyBase in this.MU0WP1r0b1(obj0.Provider, instrument))
					strategyBase.JW6Z7vfHf(instrument, bar);
				this.metaMoneyManager.OnBar(instrument, bar);
				this.OnNewBar(instrument, bar);
			}
			catch (Exception ex)
			{
				this.x6bWBlLIvv(ex);
			}
		}
Beispiel #6
0
		internal void vJjWTiUXYj(BarEventArgs obj0)
		{
			try
			{
				Instrument instrument = obj0.Instrument as Instrument;
				Bar bar = obj0.Bar;
				foreach (StrategyBase strategyBase in this.MU0WP1r0b1(obj0.Provider, instrument))
					strategyBase.vUSqZnOXC(instrument, bar);
				this.metaMoneyManager.OnBarOpen(instrument, bar);
				this.OnNewBarOpen(instrument, bar);
			}
			catch (Exception ex)
			{
				this.x6bWBlLIvv(ex);
			}
		}
Beispiel #7
0
		private void OyPFEsHGL2(object obj0, BarEventArgs obj1)
		{
			if (!this.A8bFJItyyx.BarFilter.Contains(obj1.Bar.BarType, obj1.Bar.Size))
				return;
			SingleOrder singleOrder = this.PYBF7sahqY as SingleOrder;
			if (singleOrder.OrdType == OrdType.Market)
			{
				this.Y18FFPmDy5((Quote) null, (Trade) null, obj1.Bar);
			}
			else
			{
				if (obj1.Bar == null || !this.A8bFJItyyx.FillOnBar)
					return;
				double open = obj1.Bar.Open;
				if (open == 0.0)
					return;
				this.wYBFLwFB4S(open, singleOrder.OrderQty);
			}
		}
Beispiel #8
0
		private void YgkFRBfPV0(object obj0, BarEventArgs obj1)
		{
			if (!this.A8bFJItyyx.BarFilter.Contains(obj1.Bar.BarType, obj1.Bar.Size))
				return;
			SingleOrder singleOrder = this.PYBF7sahqY as SingleOrder;
			if (singleOrder.OrdType == OrdType.Market)
			{
				this.Y18FFPmDy5((Quote) null, (Trade) null, obj1.Bar);
			}
			else
			{
				if (obj1.Bar == null || !this.A8bFJItyyx.FillOnBar)
					return;
				if (singleOrder.OrdType == OrdType.Limit || (singleOrder.OrdType == OrdType.TrailingStopLimit || singleOrder.OrdType == OrdType.StopLimit) && singleOrder.IsStopLimitReady)
				{
					switch (singleOrder.Side)
					{
						case Side.Buy:
						case Side.BuyMinus:
							if (obj1.Bar.Low <= singleOrder.Price)
							{
								this.D35FmNWSPm(singleOrder.Price, singleOrder.OrderQty);
								break;
							}
							else
								break;
						case Side.Sell:
						case Side.SellShort:
							if (obj1.Bar.High >= singleOrder.Price)
							{
								this.D35FmNWSPm(singleOrder.Price, singleOrder.OrderQty);
								break;
							}
							else
								break;
						default:
							throw new NotSupportedException(""+ ((object) singleOrder.Side).ToString());
					}
				}
				if (singleOrder.OrdType == OrdType.Stop)
				{
					switch (singleOrder.Side)
					{
						case Side.Buy:
						case Side.BuyMinus:
							if (obj1.Bar.High >= singleOrder.StopPx)
							{
								this.D35FmNWSPm(singleOrder.StopPx, singleOrder.OrderQty);
								break;
							}
							else
								break;
						case Side.Sell:
						case Side.SellShort:
							if (obj1.Bar.Low <= singleOrder.StopPx)
							{
								this.D35FmNWSPm(singleOrder.StopPx, singleOrder.OrderQty);
								break;
							}
							else
								break;
						default:
							throw new NotSupportedException("" + ((object) singleOrder.Side).ToString());
					}
				}
				if (singleOrder.OrdType == OrdType.TrailingStop)
				{
					switch (singleOrder.Side)
					{
						case Side.Buy:
						case Side.BuyMinus:
							this.zGRFvN99ge = Math.Min(this.zGRFvN99ge, obj1.Bar.Low + singleOrder.TrailingAmt);
							if (this.dkuF6t82Gt(obj1.Bar.High, this.zGRFvN99ge, this.j57Fjc16NJ) >= 0)
							{
								this.D35FmNWSPm(this.zGRFvN99ge, singleOrder.OrderQty);
								break;
							}
							else
								break;
						case Side.Sell:
						case Side.SellShort:
							this.zGRFvN99ge = Math.Max(this.zGRFvN99ge, obj1.Bar.High - singleOrder.TrailingAmt);
							if (this.dkuF6t82Gt(obj1.Bar.Low, this.zGRFvN99ge, this.j57Fjc16NJ) <= 0)
							{
								this.D35FmNWSPm(this.zGRFvN99ge, singleOrder.OrderQty);
								break;
							}
							else
								break;
						default:
							throw new NotSupportedException("" + ((object) singleOrder.Side).ToString());
					}
				}
				if (singleOrder.OrdType == OrdType.TrailingStopLimit && !singleOrder.IsStopLimitReady)
				{
					switch (singleOrder.Side)
					{
						case Side.Buy:
						case Side.BuyMinus:
							this.zGRFvN99ge = Math.Min(this.zGRFvN99ge, obj1.Bar.Low + singleOrder.TrailingAmt);
							if (this.dkuF6t82Gt(obj1.Bar.High, this.zGRFvN99ge, this.j57Fjc16NJ) >= 0)
							{
								double num = singleOrder.StopPx - singleOrder.Price;
								singleOrder.StopPx = this.zGRFvN99ge;
								singleOrder.Price = this.zGRFvN99ge - num;
								singleOrder.IsStopLimitReady = true;
								break;
							}
							else
								break;
						case Side.Sell:
						case Side.SellShort:
							this.zGRFvN99ge = Math.Max(this.zGRFvN99ge, obj1.Bar.High - singleOrder.TrailingAmt);
							if (this.dkuF6t82Gt(obj1.Bar.Low, this.zGRFvN99ge, this.j57Fjc16NJ) <= 0)
							{
								double num = singleOrder.StopPx - singleOrder.Price;
								singleOrder.StopPx = this.zGRFvN99ge;
								singleOrder.Price = this.zGRFvN99ge - num;
								singleOrder.IsStopLimitReady = true;
								break;
							}
							else
								break;
						default:
							throw new NotSupportedException("" + ((object) singleOrder.Side).ToString());
					}
				}
				if (singleOrder.OrdType != OrdType.StopLimit || singleOrder.IsStopLimitReady)
					return;
				switch (singleOrder.Side)
				{
					case Side.Buy:
					case Side.BuyMinus:
						if (obj1.Bar.High < singleOrder.StopPx)
							break;
						singleOrder.IsStopLimitReady = true;
						break;
					case Side.Sell:
					case Side.SellShort:
						if (obj1.Bar.Low > singleOrder.StopPx)
							break;
						singleOrder.IsStopLimitReady = true;
						break;
					default:
						throw new NotSupportedException("" + ((object) singleOrder.Side).ToString());
				}
			}
		}
Beispiel #9
0
 private void OnNewBar(object sender, BarEventArgs e)
 {
     lock (this.dataLock)
     {
         Position position = this.positions[(Instrument)e.Instrument];
         if (position != null)
         {
             position.EmitValueChanged();
             this.EmitValueChanged(position);
         }
     }
 }
Beispiel #10
0
 internal void EmitNewBar(BarEventArgs e)
 {
     this.Bar = e.Bar;
     if (Trace.IsLevelEnabled(TraceLevel.Verbose))
     {
         Trace.WriteLine(string.Concat(new object[]
         {
             "Symbol",
             this.Symbol,
             "Bar",
             this.Bar
         }));
     }
     if (this.NewBar != null)
     {
         this.NewBar(this, e);
     }
 }
Beispiel #11
0
 private static void EmitNewBarOpen(object sender, BarEventArgs e)
 {
     if (ProviderManager.threadSafe)
         Monitor.Enter(ProviderManager.dataLock);
     try
     {
         if (ProviderManager.NewBarOpen != null)
             ProviderManager.NewBarOpen(sender, e);
     }
     finally
     {
         if (ProviderManager.threadSafe)
             Monitor.Exit(ProviderManager.dataLock);
     }
 }
Beispiel #12
0
		private void OnNewBarOpen(object sender, BarEventArgs e)
		{
			if (this.NewBarOpen != null)
			{
				this.NewBarOpen(this, new BarEventArgs(e.Bar, e.Instrument, this));
			}
		}
Beispiel #13
0
 private void ProviderManager_NewBar(object sender, BarEventArgs args)
 {
   lock (this)
   {
     ++this.countBar;
     ++this.countMarketDataTotal;
   }
 }
Beispiel #14
0
 private void marketDataProvider_NewBar(object sender, BarEventArgs args)
 {
     FreeQuant.Instruments.Instrument instrument = args.Instrument as FreeQuant.Instruments.Instrument;
     List<StrategyRunner> list = (List<StrategyRunner>)null;
     if (!this.instrumentTable.TryGetValue(instrument, out list))
         return;
     foreach (StrategyRunner strategyRunner in list)
     {
         if (strategyRunner.Enabled)
             strategyRunner.SetNewBar(instrument, args.Bar);
     }
 }
Beispiel #15
0
 protected virtual void OnNewBar(object sender, BarEventArgs args)
 {
     if (((IntradayEventArgs)args).Provider != this.marketDataProvider)
         return;
     BarViewRow barViewRow;
     bool flag;
     lock (this.lockObject)
         flag = this.barRows.TryGetValue(((IntradayEventArgs)args).Instrument, out barViewRow);
     if (!flag)
         return;
     if (this.eventQueue.Enabled)
         this.eventQueue.Enqueue(new MarketDataUpdateItem((MarketDataViewRow)barViewRow, (Quote)null, (Trade)null, args.Bar));
     else
         barViewRow.Update((Quote)null, (Trade)null, args.Bar);
 }
Beispiel #16
0
 private void barFactory_NewBar(object sender, BarEventArgs args)
 {
   this.EmitBar(args.Instrument, args.Bar);
 }