Beispiel #1
0
		public RoundTripList(LiveTester tester):base() 
    {
      this.tester = tester;
      this.lastNotUpdatedIndex = -1;
      this.lastOpenRoundTripDate = DateTime.MaxValue;
      this.Connect();
      this.list = new ArrayList();
      this.openRoundTrips = new OpenRoundTripList();
    }
Beispiel #2
0
    internal void ztfTe4jp4()
    {
      this.isActive = true;
      this.global.Clear();
      this.stops.Clear();
      this.activeStops.Clear();
//      if (this.JEmpWIimOt != null)
//        this.JEmpWIimOt((object) this, EventArgs.Empty);
      this.triggers.Clear();
//      if (this.DGvp78okLv != null)
//        this.DGvp78okLv((object) this, EventArgs.Empty);
      this.activeInstruments.Clear();
      if (this.metaStrategyBase.MetaStrategyMode == MetaStrategyMode.Simulation || this.metaStrategyBase.MetaStrategyMode == MetaStrategyMode.Live && this.metaStrategyBase.ResetPortfolio)
      {
        this.portfolio.Clear();
        this.portfolios.Clear();
        this.testers.Clear();
        this.tester.FriendlyTesters.Clear();
      }
      this.portfolio.TransactionAdded += new TransactionEventHandler(this.wFewIKaO9);
      this.portfolio.PositionOpened += new PositionEventHandler(this.tqpmkcdnl);
      this.portfolio.PositionChanged += new PositionEventHandler(this.qmsfx90ud);
      this.portfolio.PositionClosed += new PositionEventHandler(this.iIIeZBW7d);
      this.portfolio.ValueChanged += new PositionEventHandler(this.zqRghd2Zu);
      this.portfolio.Monitored = true;
      this.orders.Clear();
      this.marketManager.Instruments.Clear();
      this.marketManager.jcIApP7GcT.Clear();
      if (this.metaStrategyBase.MetaStrategyMode == MetaStrategyMode.Live)
      {
        this.marketManager.OM26eKMfqS = this.marketDataProvider;
        this.marketManager.TOY6zSGlVT = this.executionProvider;
      }
      this.marketManager.Init();
      this.tester.Disconnect();
      this.tester.Connect();
      this.tester.Reset();
      if (this.statisticsPerInstrumentEnabled)
      {
        foreach (LiveTester liveTester in this.testers.Values)
        {
          liveTester.Connect();
          liveTester.Reset();
        }
      }
      foreach (Instrument key in (FIXGroupList) this.marketManager.Instruments)
      {
        key.Reset();
        BarSeries barSeries = this.Bars[key];
        this.activeStops[key] = new List<StopBase>();
        if (this.statisticsPerInstrumentEnabled && !this.portfolios.ContainsKey(key))
        {
          Portfolio portfolio = new Portfolio();
					portfolio.Name = string.Format("dfs", (object) this.name, (object) key.Symbol);
          if (this.metaStrategyBase.MetaStrategyMode == MetaStrategyMode.Live && !this.metaStrategyBase.ResetPortfolio)
						portfolio.Account.Deposit(this.portfolio.GetAccountValue(), this.portfolio.Account.Currency, Clock.Now,"");
          LiveTester liveTester = new LiveTester(portfolio);
          liveTester.FollowChanges = true;
          this.portfolios.Add(key, portfolio);
          this.testers.Add(key, liveTester);
          this.tester.FriendlyTesters.Add(key, liveTester);
        }
      }
      this.barSliceManager.InstrumentsCount = this.marketManager.Instruments.Count;
      this.barSliceManager.Clear();
      this.OnInit();
      this.reportManager.Tester = this.tester;
      if (this.MetaStrategyBase.dBEWaCEkLk)
        return;
      this.reportManager.Init();
    }
Beispiel #3
0
    protected StrategyBase(string name, string description)
    {
      this.metaStrategyBase = (MetaStrategyBase) null;
      this.name = name;
      this.description = description;
      this.isEnabled = true;
      this.isActive = true;
			this.ReportManager = StrategyComponentManager.GetComponent("getcom", (object) this) as ReportManager;
			this.MarketManager = StrategyComponentManager.GetComponent("getcom", (object) this) as MarketManager;
      this.portfolio = PortfolioManager.Portfolios[name];
      if (this.portfolio == null)
        this.portfolio = new Portfolio(name);
      this.tester = new LiveTester(this.portfolio);
      this.stops = new StopList();
      this.triggers = new TriggerList();
      this.marketDataProvider = (IMarketDataProvider) null;
      this.executionProvider = (IExecutionProvider) null;
      this.newsProvider = (INewsProvider) null;
      this.executionService = (IExecutionService) null;
      this.orders = new OrderTable();
      this.global = new Hashtable();
      this.activeInstruments = new InstrumentList();
      this.barSliceManager = new BarSliceManager();
      this.componentTypeList = new List<ComponentType>();
      this.componentTypeList.Add(ComponentType.MarketManager);
      this.componentTypeList.Add(ComponentType.ReportManager);
      this.activeStops = new Dictionary<Instrument, List<StopBase>>();
      this.portfolios = new Dictionary<Instrument, Portfolio>();
      this.testers = new Dictionary<Instrument, LiveTester>();
      this.statisticsPerInstrumentEnabled = false;
    }
Beispiel #4
0
		public void Start(bool doStep)
		{
			DataManager.ClearDataArrays();
			this.drawingPrimitives.Clear();
			this.wH2We9sYJA.Clear();
			this.vXRWgwkIPm.Clear();
			this.DKMWNa8OX5.Clear();
//      this.wufWtLkISI.EHNjIxPXeI();
//      this.ftRWdJyyOv.CRrjLvZRte();
//      this.XY4Ww3QE51.WlPpnQStx6();
			this.sbiWzb0PxN.Clear();
			this.EdxRkK8EdT.Clear();
//      this.J37WmrcrSi.PICjBUA7Ya();
//      this.zVLWf0C4Mc.G7CjuFqKCk();
			if (this.metaStrategyMode == MetaStrategyMode.Simulation)
			{
				this.simulationManager.Requests.Clear();
				this.simulationManager.Init();
				Clock.ClockMode = ClockMode.Simulation;
				Clock.SetDateTime(this.simulationManager.EntryDate);
				foreach (string request in (CollectionBase) this.simulationManager.StaticRequests)
					this.simulationManager.SendMarketDataRequest(request);
				this.simulator.Intervals.Clear();
				this.simulator.Intervals.Add(this.simulationManager.EntryDate, this.simulationManager.ExitDate);
				this.simulator.SimulationMode = this.simulationManager.Mode;
				this.simulator.SpeedMultiplier = this.simulationManager.SpeedMultiplier;
				this.simulator.Step = this.simulationManager.Step;
				OrderManager.RemoveOrders(11104, (object)MetaStrategyBase.FIX_MODES[this.metaStrategyMode]);
				OrderManager.OCA.Clear();
				OrderManager.SellSide.RemoveOrders(11104, (object)MetaStrategyBase.FIX_MODES[this.metaStrategyMode]);
			}
			if (this.metaStrategyMode == MetaStrategyMode.Simulation || this.metaStrategyMode == MetaStrategyMode.Live && this.resetPortfolio)
			{
				this.portfolio.Clear();
				this.portfolios.Clear();
				this.testers.Clear();
				this.tester.FriendlyTesters.Clear();
			}
			this.tester.Disconnect();
			this.tester.Connect();
			this.tester.Reset();
			bool flag = this.portfolio.Account.Transactions.Count == 0;
			if (flag)
				this.portfolio.Account.Deposit(this.simulationManager.Cash, this.simulationManager.Currency, Clock.Now, "");
			this.portfolio.TransactionAdded += new TransactionEventHandler(this.zYSWMuDaZ6);
			this.portfolio.PositionOpened += new PositionEventHandler(this.DBwWbS3fHQ);
			this.portfolio.PositionChanged += new PositionEventHandler(this.dHgWygCawL);
			this.portfolio.PositionClosed += new PositionEventHandler(this.fBgWGZmneO);
			this.portfolio.ValueChanged += new PositionEventHandler(this.lrZWS42MFZ);
			this.portfolio.Monitored = true;
			this.optimizationManager.Init();
			if (!this.isOptimizing)
			{
				this.reportManager.Tester = this.tester;
				this.reportManager.Init();
			}
			this.metaMoneyManager.Init();
			this.OnInit();
			foreach (StrategyBase strategyBase in this.strategies)
			{
				if (strategyBase.IsEnabled)
					strategyBase.ztfTe4jp4();
			}
			if (flag)
				this.OnMoneyAllocation();
			if (this.statisticsPerInstrumentEnabled)
			{
				foreach (LiveTester liveTester in this.testers.Values)
				{
					liveTester.Connect();
					liveTester.Reset();
				}
				foreach (StrategyBase strategyBase in this.strategies)
				{
					if (strategyBase.IsEnabled)
					{
						foreach (Instrument key in (FIXGroupList) strategyBase.MarketManager.Instruments)
						{
							if (!this.portfolios.ContainsKey(key))
							{
								Portfolio portfolio = new Portfolio();
								portfolio.Name = string.Format("dfds", (object)this.name, (object)key.Symbol);
								LiveTester liveTester = new LiveTester(portfolio);
								liveTester.FollowChanges = true;
								this.portfolios.Add(key, portfolio);
								this.testers.Add(key, liveTester);
								this.tester.FriendlyTesters.Add(key, liveTester);
								portfolio.Account.Deposit(this.portfolio.GetAccountValue(), this.portfolio.Account.Currency, Clock.Now, "fdsdfs");
							}
						}
					}
				}
			}
			foreach (StrategyBase strategyBase in this.strategies)
			{
				if (strategyBase.IsEnabled)
				{
					switch (this.metaStrategyMode)
					{
						case MetaStrategyMode.Simulation:
//              this.XY4Ww3QE51.opTpuIsCq8(ProviderManager.ExecutionSimulator);
//              this.wufWtLkISI.q4hj9rUKgj((IProvider) ProviderManager.MarketDataSimulator);
//              this.wufWtLkISI.q4hj9rUKgj((IProvider) ProviderManager.ExecutionSimulator);
							this.fkKW08cp5Q((IProvider)ProviderManager.MarketDataSimulator, strategyBase);
							this.fkKW08cp5Q((IProvider)ProviderManager.ExecutionSimulator, strategyBase);
							break;
						case MetaStrategyMode.Live:
							using (Dictionary<Instrument, IExecutionProvider>.ValueCollection.Enumerator enumerator = strategyBase.MarketManager.UyiAAd6ITD.Values.GetEnumerator())
							{
								while (enumerator.MoveNext())
								{
									IExecutionProvider current = enumerator.Current;
									this.fkKW08cp5Q((IProvider)current, strategyBase);
//                  this.XY4Ww3QE51.opTpuIsCq8(current);
//                  this.wufWtLkISI.q4hj9rUKgj((IProvider) current);
								}
								break;
							}
					}
					foreach (KeyValuePair<Instrument, IMarketDataProvider> keyValuePair in strategyBase.MarketManager.jcIApP7GcT)
					{
						Instrument key = keyValuePair.Key;
						switch (this.metaStrategyMode)
						{
							case MetaStrategyMode.Simulation:
								foreach (string str in (CollectionBase) this.simulationManager.Requests)
//                  this.ftRWdJyyOv.s8pj3BZbXy(ProviderManager.MarketDataSimulator, key, str);
                this.gKXWX8nbQ1(ProviderManager.MarketDataSimulator, key, strategyBase);
								continue;
							case MetaStrategyMode.Live:
								IMarketDataProvider marketDataProvider = keyValuePair.Value;
//                this.ftRWdJyyOv.s8pj3BZbXy(marketDataProvider, key, (string) null);
//                this.wufWtLkISI.q4hj9rUKgj((IProvider) marketDataProvider);
								this.fkKW08cp5Q((IProvider)marketDataProvider, strategyBase);
								this.gKXWX8nbQ1(marketDataProvider, key, strategyBase);
								continue;
							default:
								continue;
						}
					}
				}
			}
//      this.wufWtLkISI.qGIjh9udFb(this.a0bRpgOve7 * 1000);
//      this.ftRWdJyyOv.ONMjs3DrA4();
//      this.XY4Ww3QE51.W2BpYr8f5G();
			if (this.executionServicesEnabled)
			{
				foreach (StrategyBase strategyBase in this.strategies)
				{
					switch (this.metaStrategyMode)
					{
						case MetaStrategyMode.Simulation:
							this.FYDWx9TtsR(ServiceManager.ExecutionSimulator, strategyBase);
							continue;
						case MetaStrategyMode.Live:
							if (strategyBase.ExecutionService != null)
							{
								this.FYDWx9TtsR((IService)strategyBase.ExecutionService, strategyBase);
								continue;
							}
							else
								continue;
						default:
							continue;
					}
				}
//        this.J37WmrcrSi.D3Cjbhc7hR();
//        this.zVLWf0C4Mc.alJjoPx37X();
			}
			this.isRunning = true;
			switch (this.metaStrategyMode)
			{
				case MetaStrategyMode.Simulation:
					if (doStep)
					{
						this.simulator.DoStep(false);
						while (this.isRunning)
							Thread.Sleep(1);
						break;
					}
					else
					{
						this.simulator.Start(true);
						break;
					}
				case MetaStrategyMode.Live:
					this.Y5hW7EWwMM();
					while (this.isRunning)
						Thread.Sleep(1);
					break;
			}
		}
Beispiel #5
0
		protected MetaStrategyBase(string name)
		{
			this.name = name;
			this.strategies = new StrategyList();
			this.SimulationManager = StrategyComponentManager.GetComponent("GetComponent", (object)this) as SimulationManager;
			this.OptimizationManager = StrategyComponentManager.GetComponent("GetComponent", (object)this) as OptimizationManager;
			this.ReportManager = StrategyComponentManager.GetComponent("GetComponent", (object)this) as ReportManager;
			this.MetaMoneyManager = StrategyComponentManager.GetComponent("GetComponent", (object)this) as MetaMoneyManager;
			this.portfolio = PortfolioManager.Portfolios[name];
			if (this.portfolio == null)
				this.portfolio = new Portfolio(name);
			this.resetPortfolio = true;
			this.tester = new LiveTester(this.portfolio);
			this.tester.FollowChanges = true;
			this.optimizer = (Optimizer)new BruteForce((IOptimizable)this);
			this.optimizer.BestObjectiveReceived += new EventHandler(this.OnBestObjectiveReceived);
			this.optimizerType = EOptimizerType.BruteForce;
//      this.wufWtLkISI = new J8EmIiFmOtaja37OfO(this);
//      this.ftRWdJyyOv = new cLHjLO4PpuI7TxofSw(this);
//      this.XY4Ww3QE51 = new TGZcynM7UfxwdxKdmx(this);
//      this.J37WmrcrSi = new FZ0WAbPUwn6OHn5Upr(this);
//      this.zVLWf0C4Mc = new ALxag60bMZlMBTZjqL(this);
			this.wH2We9sYJA = new Dictionary<IProvider, List<StrategyBase>>();
			this.vXRWgwkIPm = new Dictionary<IMarketDataProvider, Dictionary<Instrument, List<StrategyBase>>>();
			this.DKMWNa8OX5 = new Dictionary<SingleOrder, StrategyBase>();
			this.sbiWzb0PxN = new Dictionary<IService, List<StrategyBase>>();
			this.EdxRkK8EdT = new Dictionary<IExecutionService, List<StrategyBase>>();
			this.maxConnectionTime = 10;
			this.simulator = (ProviderManager.MarketDataSimulator as SimulationDataProvider).Simulator;
			this.simulator.StateChanged += new EventHandler(this.md8Wiw2OiW);
			this.isRunning = false;
			this.isOptimizing = false;
			this.optimizationParemeters = new ArrayList();
			this.drawingPrimitives = new Hashtable();
			this.portfolioStopList = new StopList();
			this.portfolios = new Dictionary<Instrument, Portfolio>();
			this.testers = new Dictionary<Instrument, LiveTester>();
			this.executionServicesEnabled = false;
			this.componentTypeList = new List<ComponentType>();
			this.componentTypeList.Add(ComponentType.SimulationManager);
			this.componentTypeList.Add(ComponentType.MetaMoneyManager);
			this.componentTypeList.Add(ComponentType.OptimizationManager);
			this.componentTypeList.Add(ComponentType.ReportManager);
		}
Beispiel #6
0
    public TradeDays(string name, LiveTester tester)
			:      base(name) {
      this.tester = tester;
    }
Beispiel #7
0
    public TradeDays(string name, LiveTester tester, string format)
			: base(name, format)
		{

      this.tester = tester;
    }
Beispiel #8
0
		public PerformanceTrackerList(LiveTester tester):base()
    {
       this.muZcYBahg = tester;
      lock (tester)
        this.hmtJ5q6yp();
    }
Beispiel #9
0
		public TesterSettings(LiveTester tester):base()
    {
      this.fNyFvVvOo = tester;
      this.FXUR2afwm();
    }
Beispiel #10
0
 public void EnableTester()
 {
     this.tester = new LiveTester(this.portfolio);
     this.tester.TimeInterval = this.testerPeriod;
     this.tester.DisableComponents();
     if (!this.testerEnabled)
     {
         this.tester.AllowRoundTrips = false;
     }
     else
     {
         this.tester.Disconnect();
         this.tester.Connect();
         this.tester.Reset();
         this.tester.FollowChanges = true;
         this.tester.AllowRoundTrips = true;
         this.AddTesterComponents();
     }
 }
Beispiel #11
0
    public static TesterItem LoadComponent(LiveTester tester, string fileName)
    {
      StreamReader streamReader = new StreamReader(fileName);
      string str1 = streamReader.ReadLine();
			TesterItem component = TesterComponentManager.GetComponent(str1.Remove(0, str1.IndexOf("fddf") + 3));
      string str2;
      while ((str2 = streamReader.ReadLine()) != null)
        TesterComponentManager.zWD3jRjZ4(tester, component, str2, fileName);
      streamReader.Close();
      return component;
    }
Beispiel #12
0
 public void PrepareTester()
 {
   bool flag = (bool) this.sampleStrategy.GetType().GetField("ReportEnabled", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField).GetValue((object) this.sampleStrategy);
   TimeIntervalSize timeIntervalSize = (TimeIntervalSize) this.sampleStrategy.GetType().GetField("TestingPeriod", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.SetField).GetValue((object) this.sampleStrategy);
   this.tester = new LiveTester(this.sq_Portfolio);
         this.tester.TimeInterval = timeIntervalSize;
   this.tester.DisableComponents();
   if (!flag)
   {
             this.tester.AllowRoundTrips = false;
   }
   else
   {
     this.tester.Disconnect();
     this.tester.Connect();
     this.tester.Reset();
             this.tester.FollowChanges = true;
             this.tester.AllowRoundTrips = true;
     this.AddTesterComponents();
   }
 }
Beispiel #13
0
    public FinalWealth(string name, LiveTester tester)
			:      base(name, "")
		{
      this.tester = tester;
    }
Beispiel #14
0
    public FinalWealth(string name, LiveTester tester, string format)
			:  base(name, format) {
      this.tester = tester;
    }