コード例 #1
0
 /*------------自己添加-----------*/
 internal void MarketInit()
 {
     this.activeInstruments.Clear();
     this.marketManager.Instruments.Clear();
     this.marketManager.MarketDataProviderTable.Clear();
     this.marketManager.Init();
     foreach (Instrument instrument in this.marketManager.Instruments)
     {
         instrument.Reset();
         BarSeries arg_24E_0 = this.Bars[instrument];
         this.activeStops[instrument] = new List <StopBase>();
         if (this.statisticsPerInstrumentEnabled && !this.portfolios.ContainsKey(instrument))
         {
             Portfolio portfolio = new Portfolio();
             portfolio.Name = string.Format("{0} [{1}]", this.name, instrument.Symbol);
             if (this.metaStrategyBase.MetaStrategyMode == MetaStrategyMode.Live && !this.metaStrategyBase.ResetPortfolio)
             {
                 portfolio.Account.Deposit(this.portfolio.GetAccountValue(), this.portfolio.Account.Currency, Clock.Now, "Initial Cash Allocation");
             }
             LiveTester liveTester = new LiveTester(portfolio);
             liveTester.FollowChanges = true;
             this.portfolios.Add(instrument, portfolio);
             this.testers.Add(instrument, liveTester);
             this.tester.FriendlyTesters.Add(instrument, liveTester);
         }
     }
     this.barSliceManager.InstrumentsCount = this.marketManager.Instruments.Count;
     this.barSliceManager.Reset();
     this.OnCrossBehaviorInit();
     this.OnBehaviorInit();
 }
コード例 #2
0
ファイル: StrategyBase.cs プロジェクト: zhuzhenping/FreeOQ
 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;
 }
コード例 #3
0
        private static void zWD3jRjZ4([In] LiveTester obj0, [In] TesterItem obj1, [In] string obj2, [In] string obj3)
        {
            string       name     = obj2.Substring(0, obj2.IndexOf("dfs"));
            string       index    = obj2.Remove(0, obj2.IndexOf("fdds") + 3);
            PropertyInfo property = obj1.GetType().GetProperty(name);
            object       obj      = (object)null;

            if (property.PropertyType.IsSubclassOf(typeof(TesterItem)))
            {
                if (obj0.Components.Contains(index))
                {
                    obj = (object)obj0.Components[index];
                }
                else if (index != "")
                {
                    obj = !new FileInfo((string)(object)(obj3.LastIndexOf("ddf") + 1) + (object)index).Exists ? (object)TesterComponentManager.GetComponent(index) : (object)TesterComponentManager.LoadComponent(obj0, obj3.Substring(0, obj3.LastIndexOf("sdas") + 1) + index);
                }
            }
            else if (property.PropertyType == typeof(double))
            {
                obj = (object)double.Parse(index);
            }
            else if (property.PropertyType == typeof(string))
            {
                obj = (object)index;
            }
            else if (property.PropertyType == typeof(int))
            {
                obj = (object)int.Parse(index);
            }
            property.SetValue((object)obj1, obj, (object[])null);
        }
コード例 #4
0
 protected StrategyBase(string name, string description)
 {
     this.metaStrategyBase = null;
     this.name             = name;
     this.description      = description;
     this.isEnabled        = true;
     this.isActive         = true;
     this.ReportManager    = (StrategyComponentManager.GetComponent("{5E7810DC-C9C1-427f-8CD9-1DFFE26E59B5}", this) as ReportManager);
     this.MarketManager    = (StrategyComponentManager.GetComponent("{849E4CFE-C19E-4d1e-899D-0BB26DB12AAD}", 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 = null;
     this.executionProvider  = null;
     this.newsProvider       = null;
     this.executionService   = 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;
 }
コード例 #5
0
 private void kOWyDvDJH4([In] LiveTester obj0)
 {
     foreach (RoundTrip roundTrip in this.openRoundTrips)
     {
         roundTrip.Cancel();
     }
 }
コード例 #6
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();
 }
コード例 #7
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);
        }
コード例 #8
0
 private void BK4yT8IfHC([In] LiveTester obj0)
 {
     if (this.list.Count > 0 || this.openRoundTrips.Count > 0)
     {
         int index = this.list.Count - 1;
         while (index >= 0 && this.lastOpenRoundTripDate <= (this.list[index] as RoundTrip).ExitDateTime)
         {
             --index;
         }
         this.lastOpenRoundTripDate = this.openRoundTrips.Count <= 0 ? DateTime.MaxValue : this.openRoundTrips[0].ExitDateTime;
         this.lastNotUpdatedIndex   = index;
     }
     else
     {
         this.lastNotUpdatedIndex = -1;
     }
     this.JN2yhT4OtC(this.lastNotUpdatedIndex);
 }
コード例 #9
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();
     }
 }
コード例 #10
0
ファイル: StrategyRunner.cs プロジェクト: zhuzhenping/FreeOQ
        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();
            }
        }
コード例 #11
0
ファイル: TesterSettings.cs プロジェクト: zhuzhenping/FreeOQ
 public TesterSettings(LiveTester tester) : base()
 {
     this.fNyFvVvOo = tester;
     this.FXUR2afwm();
 }
コード例 #12
0
 public FinalWealth(string name, LiveTester tester)
     :      base(name, "")
 {
     this.tester = tester;
 }
コード例 #13
0
 public FinalWealth(string name, LiveTester tester, string format)
     :  base(name, format)
 {
     this.tester = tester;
 }
コード例 #14
0
ファイル: TotalDays.cs プロジェクト: zhuzhenping/FreeOQ
 public TotalDays(string name, LiveTester tester)
     :      base(name)
 {
     this.tester = tester;
 }
コード例 #15
0
ファイル: TotalDays.cs プロジェクト: zhuzhenping/FreeOQ
 public TotalDays(string name, LiveTester tester, string format)
     :  base(name, format)
 {
     this.tester = tester;
 }
コード例 #16
0
ファイル: StrategyBase.cs プロジェクト: zhuzhenping/FreeOQ
        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();
        }
コード例 #17
0
 public PerformanceTrackerList(LiveTester tester) : base()
 {
     this.muZcYBahg = tester;
     lock (tester)
         this.hmtJ5q6yp();
 }