예제 #1
0
		private void Init(SmartQuant.Instruments.Portfolio sq_Portfolio, SmartQuant.Instruments.Portfolio sq_MetaPortfolio, SmartQuant.Instruments.Instrument sq_Instrument, DataRequests strategyRequests, string strategyName, IStrategyLogManager strategyLogManager)
		{
			this.sq_Instrument = sq_Instrument;
			this.instrument = (Map.SQ_OQ_Instrument[sq_Instrument] as Instrument);
			this.portfolio = (Map.SQ_OQ_Portfolio[sq_Portfolio] as Portfolio);
			this.metaPortfolio = (Map.SQ_OQ_Portfolio[sq_MetaPortfolio] as Portfolio);
			this.performance = new Performance(this.portfolio);
			this.metaPerformance = new Performance(this.metaPortfolio);
			this.dataRequests = strategyRequests;
			this.strategyName = strategyName;
			this.strategyLogManager = strategyLogManager;
		}
예제 #2
0
파일: Strategy.cs 프로젝트: heber/FreeOQ
 private void Init(FreeQuant.Instruments.Portfolio sq_Portfolio, FreeQuant.Instruments.Portfolio sq_MetaPortfolio, FreeQuant.Instruments.Instrument sq_Instrument, DataRequests strategyRequests, string strategyName, IStrategyLogManager strategyLogManager)
 {
   this.sq_Instrument = sq_Instrument;
   this.instrument = Map.FQ_OQ_Instrument[(object) sq_Instrument] as Instrument;
   this.portfolio = Map.FQ_OQ_Portfolio[(object) sq_Portfolio] as Portfolio;
   this.metaPortfolio = Map.FQ_OQ_Portfolio[(object) sq_MetaPortfolio] as Portfolio;
   this.performance = new Performance(this.portfolio);
   this.metaPerformance = new Performance(this.metaPortfolio);
   this.dataRequests = strategyRequests;
   this.strategyName = strategyName;
   this.strategyLogManager = strategyLogManager;
 }
예제 #3
0
파일: Solution.cs 프로젝트: heber/FreeOQ
		private Solution()
		{
			this.Requests = new DataRequests();
		}
예제 #4
0
 private DataRequests BuildStrategyRequest()
 {
     bool flag1 = false;
     bool flag2 = false;
     bool flag3 = false;
     bool flag4 = false;
     bool flag5 = false;
     List<OpenQuant.API.BarRequest> list = new List<OpenQuant.API.BarRequest>();
     foreach (MarketDataRequest marketDataRequest in this.requests)
     {
         if (marketDataRequest.Enabled)
         {
             switch (marketDataRequest.RequestType)
             {
                 case RequestType.Trade:
                     flag3 = true;
                     continue;
                 case RequestType.Quote:
                     flag2 = true;
                     continue;
                 case RequestType.MarketDepth:
                     flag5 = true;
                     continue;
                 case RequestType.Bar:
                     flag1 = true;
                     BarRequest barRequest = marketDataRequest as BarRequest;
                     if (barRequest.IsBarFactoryRequest)
                         flag3 = true;
                     list.Add(new OpenQuant.API.BarRequest(this.ConvertBarType(barRequest.BarType), barRequest.BarSize, barRequest.IsBarFactoryRequest));
                     continue;
                 case RequestType.Daily:
                     flag4 = true;
                     continue;
                 default:
                     continue;
             }
         }
     }
     DataRequests dataRequests = new DataRequests();
     dataRequests.GetType().GetProperty("HasBarRequests", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetProperty | BindingFlags.SetProperty).SetValue((object)dataRequests, flag1, (object[])null);
     dataRequests.GetType().GetProperty("HasTradeRequest", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetProperty | BindingFlags.SetProperty).SetValue((object)dataRequests, flag3, (object[])null);
     dataRequests.GetType().GetProperty("HasQuoteRequest", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetProperty | BindingFlags.SetProperty).SetValue((object)dataRequests, flag2, (object[])null);
     dataRequests.GetType().GetProperty("HasDailyRequest", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetProperty | BindingFlags.SetProperty).SetValue((object)dataRequests, flag4, (object[])null);
     dataRequests.GetType().GetProperty("HasMarketDepthRequest", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetProperty | BindingFlags.SetProperty).SetValue((object)dataRequests, flag5, (object[])null);
     MethodInfo methodInfo1 = (MethodInfo)null;
     foreach (MethodInfo methodInfo2 in dataRequests.BarRequests.GetType().GetMethods())
     {
         if (methodInfo2.Name == "Add" && methodInfo2.GetParameters().Length == 1)
             methodInfo1 = methodInfo2;
     }
     foreach (OpenQuant.API.BarRequest barRequest in list)
         methodInfo1.Invoke((object)dataRequests.BarRequests, new object[1]
         {
             (object)barRequest
         });
     return dataRequests;
 }